[llvm] r335897 - [Debugify] Do not report line 0 locations as errors
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 2 10:13:48 PDT 2018
Thanks, I like the -implicit-check-not idea, done in r336123.
vedant
> On Jul 2, 2018, at 9:28 AM, paul.robinson at sony.com wrote:
>
>
>
>> -----Original Message-----
>> From: vsk at apple.com [mailto:vsk at apple.com]
>> Sent: Monday, July 02, 2018 12:17 PM
>> To: Robinson, Paul
>> Cc: llvm-commits at lists.llvm.org
>> Subject: Re: [llvm] r335897 - [Debugify] Do not report line 0 locations as
>> errors
>>
>>
>>
>>> On Jul 2, 2018, at 8:25 AM, paul.robinson at sony.com wrote:
>>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org] On
>> Behalf
>>>> Of Vedant Kumar via llvm-commits
>>>> Sent: Thursday, June 28, 2018 2:21 PM
>>>> To: llvm-commits at lists.llvm.org
>>>> Subject: [llvm] r335897 - [Debugify] Do not report line 0 locations as
>>>> errors
>>>>
>>>> Author: vedantk
>>>> Date: Thu Jun 28 11:21:11 2018
>>>> New Revision: 335897
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=335897&view=rev
>>>> Log:
>>>> [Debugify] Do not report line 0 locations as errors
>>>>
>>>> The checking logic should not treat artificial locations as being
>>>> somehow problematic. Producing these locations can be the desired
>>>> behavior of some passes.
>>>>
>>>> See llvm.org/PR37961.
>>>>
>>>> Added:
>>>> llvm/trunk/test/DebugInfo/debugify-report-missing-locs-only.ll
>>>> Modified:
>>>> llvm/trunk/tools/opt/Debugify.cpp
>>>>
>>>> Added: llvm/trunk/test/DebugInfo/debugify-report-missing-locs-only.ll
>>>> URL: http://llvm.org/viewvc/llvm-
>>>> project/llvm/trunk/test/DebugInfo/debugify-report-missing-locs-
>>>> only.ll?rev=335897&view=auto
>>>>
>> ==========================================================================
>>>> ====
>>>> --- llvm/trunk/test/DebugInfo/debugify-report-missing-locs-only.ll
>> (added)
>>>> +++ llvm/trunk/test/DebugInfo/debugify-report-missing-locs-only.ll Thu
>> Jun
>>>> 28 11:21:11 2018
>>>> @@ -0,0 +1,31 @@
>>>> +; RUN: opt -check-debugify < %s -S -o - 2>&1 | FileCheck %s
>>>> +
>>>> +; CHECK: ERROR: Instruction with empty DebugLoc in function foo --
>> ret
>>>> void
>>>> +define void @foo() !dbg !6 {
>>>> + ret void
>>>> +}
>>>> +
>>>
>>> Please put a CHECK-LABEL before the CHECK-NOT so we can be sure the two
>>> checks are looking at the correct functions.
>>
>> Each check contains the function name it's checking for explicitly. Is
>> that insufficient? If so, what label would we check for, given that
>> diagnostics and IR are printed to different files?
>
> Ah, sorry, missed that the diagnostics are on stderr.
> But when I see CHECK followed by CHECK-NOT, I always get worried about
> things being reordered, and then a CHECK-NOT doesn't look at all the
> output you want it to look at, and so gives you a false pass.
>
> Two common ways to address that are to repeat the CHECK-NOT on both
> sides of the CHECK, or use `--implicit-check-not` in the FileCheck call.
> --paulr
>
>>
>> thanks,
>> vedant
>>
>>
>>> Thanks,
>>> --paulr
>>>
>>>> +; CHECK-NOT: ERROR: Instruction with empty DebugLoc in function bar
>>>> +define i32 @bar() !dbg !9 {
>>>> + ret i32 0, !dbg !15
>>>> +}
>>>> +
>>>> +declare void @llvm.dbg.value(metadata, metadata, metadata)
>>>> +
>>>> +!llvm.dbg.cu = !{!0}
>>>> +!llvm.debugify = !{!3, !4}
>>>> +!llvm.module.flags = !{!5}
>>>> +
>>>> +!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer:
>>>> "debugify", isOptimized: true, runtimeVersion: 0, emissionKind:
>> FullDebug,
>>>> enums: !2)
>>>> +!1 = !DIFile(filename: "void", directory: "/")
>>>> +!2 = !{}
>>>> +!3 = !{i32 6}
>>>> +!4 = !{i32 1}
>>>> +!5 = !{i32 2, !"Debug Info Version", i32 3}
>>>> +!6 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope:
>> null,
>>>> file: !1, line: 1, type: !7, isLocal: false, isDefinition: true,
>>>> scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !2)
>>>> +!7 = !DISubroutineType(types: !2)
>>>> +!9 = distinct !DISubprogram(name: "bar", linkageName: "bar", scope:
>> null,
>>>> file: !1, line: 2, type: !7, isLocal: false, isDefinition: true,
>>>> scopeLine: 2, isOptimized: true, unit: !0, retainedNodes: !10)
>>>> +!10 = !{!11}
>>>> +!11 = !DILocalVariable(name: "1", scope: !9, file: !1, line: 3, type:
>>>> !12)
>>>> +!12 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
>>>> +!15 = !DILocation(line: 0, column: 1, scope: !9)
>>>>
>>>> Modified: llvm/trunk/tools/opt/Debugify.cpp
>>>> URL: http://llvm.org/viewvc/llvm-
>>>>
>> project/llvm/trunk/tools/opt/Debugify.cpp?rev=335897&r1=335896&r2=335897&v
>>>> iew=diff
>>>>
>> ==========================================================================
>>>> ====
>>>> --- llvm/trunk/tools/opt/Debugify.cpp (original)
>>>> +++ llvm/trunk/tools/opt/Debugify.cpp Thu Jun 28 11:21:11 2018
>>>> @@ -237,11 +237,13 @@ bool checkDebugifyMetadata(Module &M,
>>>> continue;
>>>> }
>>>>
>>>> - dbg() << "ERROR: Instruction with empty DebugLoc in function ";
>>>> - dbg() << F.getName() << " --";
>>>> - I.print(dbg());
>>>> - dbg() << "\n";
>>>> - HasErrors = true;
>>>> + if (!DL) {
>>>> + dbg() << "ERROR: Instruction with empty DebugLoc in function
>> ";
>>>> + dbg() << F.getName() << " --";
>>>> + I.print(dbg());
>>>> + dbg() << "\n";
>>>> + HasErrors = true;
>>>> + }
>>>> }
>>>>
>>>> // Find missing variables and mis-sized debug values.
>>>>
>>>>
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at lists.llvm.org
>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180702/b2a3976a/attachment-0001.html>
More information about the llvm-commits
mailing list