<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jan 25, 2015 at 11:55 PM, Hao Liu <span dir="ltr"><<a href="mailto:Hao.Liu@arm.com" target="_blank">Hao.Liu@arm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi David,<br>
<br>
This commit breaks our internal tests.<br>
<br>
It seems we cannot remove this work around. Current trunk cannot pass the<br>
removed test case test/DebugInfo/duplicate_inline.ll.</blockquote><div><br>That's why the test case was removed in this commit - it's no longer passes but it's no longer representative of any IR that clang produces (well, it wasn't really clang producing this IR - it was the LLVM inliner pass/utility, which has now been fixed not to produce this). How/why did you end up running the compiler against the deleted test case?<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> To reproduce it as<br>
following:<br>
    llc < duplicate_inline.ll<br>
    clang-3.6: llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp:171: void<br>
llvm::DwarfFile::addScopeVariable(llvm::LexicalScope *, llvm::DbgVariable<br>
*): Assertion `CurNum != ArgNum && "Duplicate argument"' failed.<br>
    0  clang-3.6       0x00000000011134c8<br>
llvm::sys::PrintStackTrace(_IO_FILE*) + 40<br>
<br>
Thanks,<br>
-Hao<br>
<div><div class="h5"><br>
>>-----Original Message-----<br>
>>From: <a href="mailto:llvm-commits-bounces@cs.uiuc.edu">llvm-commits-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:llvm-commits-">llvm-commits-</a><br>
>><a href="mailto:bounces@cs.uiuc.edu">bounces@cs.uiuc.edu</a>] On Behalf Of David Blaikie<br>
>>Sent: 2015年1月23日 1:50<br>
>>To: <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>>Subject: [llvm] r226842 - Revert "PR21408: Workaround the appearance of<br>
>>duplicate variables due to problems when inlining two calls to the same<br>
>>function from the same call site."<br>
>><br>
>>Author: dblaikie<br>
>>Date: Thu Jan 22 11:49:59 2015<br>
>>New Revision: 226842<br>
>><br>
>>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=226842&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=226842&view=rev</a><br>
>>Log:<br>
>>Revert "PR21408: Workaround the appearance of duplicate variables due to<br>
>>problems when inlining two calls to the same function from the same call<br>
>>site."<br>
>><br>
>>The underlying bug has been fixed in r226736 so there's no need to<br>
>>workaround this anymore.<br>
>><br>
>>This reverts commit r220923.<br>
>><br>
>>Removed:<br>
>>    llvm/trunk/test/DebugInfo/duplicate_inline.ll<br>
>>Modified:<br>
>>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp<br>
>><br>
>>Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp<br>
>>URL: <a href="http://llvm.org/viewvc/llvm-" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
>>project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp?rev=226842&r1=2<br>
>>26841&r2=226842&view=diff<br>
>>===============================================================<br>
>>===============<br>
>>--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp (original)<br>
>>+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp Thu Jan 22 11:49:59<br>
</div></div>>>+++ 2015<br>
<div class="HOEnZb"><div class="h5">>>@@ -168,12 +168,7 @@ void DwarfFile::addScopeVariable(Lexical<br>
>>       // A later indexed parameter has been found, insert immediately<br>
before<br>
>>it.<br>
>>       if (CurNum > ArgNum)<br>
>>         break;<br>
>>-      // FIXME: There are still some cases where two inlined functions<br>
are<br>
>>-      // conflated together (two calls to the same function at the same<br>
>>-      // location (eg: via a macro, or without column info, etc)) and<br>
then<br>
>>-      // their arguments are conflated as well.<br>
>>-      assert((LS->getParent() || CurNum != ArgNum) &&<br>
>>-             "Duplicate argument for top level (non-inlined) function");<br>
>>+      assert(CurNum != ArgNum && "Duplicate argument");<br>
>>       ++I;<br>
>>     }<br>
>>     Vars.insert(I, Var);<br>
>><br>
>>Removed: llvm/trunk/test/DebugInfo/duplicate_inline.ll<br>
>>URL: <a href="http://llvm.org/viewvc/llvm-" target="_blank">http://llvm.org/viewvc/llvm-</a><br>
>>project/llvm/trunk/test/DebugInfo/duplicate_inline.ll?rev=226841&view=auto<br>
>>===============================================================<br>
>>===============<br>
>>--- llvm/trunk/test/DebugInfo/duplicate_inline.ll (original)<br>
>>+++ llvm/trunk/test/DebugInfo/duplicate_inline.ll (removed)<br>
>>@@ -1,117 +0,0 @@<br>
>>-; REQUIRES: object-emission<br>
>>-<br>
>>-; RUN: %llc_dwarf < %s -filetype=obj | llvm-dwarfdump -debug-dump=info -<br>
|<br>
>>FileCheck %s<br>
>>-<br>
>>-; Built with clang from the following source:<br>
>>-; void f1(int);<br>
>>-; __attribute__((always_inline)) inline void f2(int i) { f1(i); } -; -;<br>
#define<br>
>>MULTICALL \<br>
>>-;   f2(x);          \<br>
>>-;   f2(y);<br>
>>-;<br>
>>-; void f3(int x, int y) { MULTICALL; }<br>
>>-<br>
>>-; FIXME: This produces only one inlined_subroutine, with two<br>
>>formal_parameters -; (both named "this"), one for each of the actual<br>
inlined<br>
>>subroutines.  ; -; Inlined scopes are differentiated by the combination of<br>
>>'inlined at' (call) -; location and the location within the function. If<br>
two calls to<br>
>>the same -; function occur at the same location the scopes end up<br>
conflated<br>
>>and there -; appears to be only one inlined function.<br>
>>-; To fix this, we'd need to add some kind of unique metadata per call<br>
site,<br>
>>possibly something like:<br>
>>-;<br>
>>-; !42 = !MDLocation(line: 1, scope: !43, inlinedAt: !44) -; !44<br>
>>= !MDLocation(line: 2, scope: !45) -; -; -> -; -; !42 = !MDLocation(line:<br>
1,<br>
>>scope: !43, inlinedAt: !44) -; !44 = !{!45, !44} -; !45 =<br>
!MDLocation(line: 2,<br>
>>scope: !45) -; -; since cycles in metadata are not uniqued, the !44 node<br>
would<br>
>>not be shared -; between calls to the same function from the same<br>
location,<br>
>>ensuring separate -; inlined subroutines would be generated.<br>
>>-;<br>
>>-; Once this is done, the (insufficient) hack in clang that adds column -;<br>
>>information to call sites to differentiate inlined callers can be removed<br>
as it -;<br>
>>will no longer be necessary.<br>
>>-;<br>
>>-; While it might be nice to omit the duplicate parameter in this case<br>
(while -;<br>
>>we wait/work on the real fix), it's actually better to leave it in because<br>
it -;<br>
>>allows us to hold the invariant that every DbgVariable has a DIE, every<br>
time.<br>
>>-; This has proved valuable in finding other bugs, so I want to avoid<br>
removing<br>
>>the -; invariant/assertion. Besides, we don't know which one's the right<br>
one<br>
>>anyway...<br>
>>-<br>
>>-; CHECK: DW_TAG_subprogram<br>
>>-; CHECK:   DW_TAG_inlined_subroutine<br>
>>-; CHECK:     DW_TAG_formal_parameter<br>
>>-; CHECK-NOT: DW_TAG<br>
>>-; CHECK:     DW_TAG_formal_parameter<br>
>>-; CHECK-NOT: DW_TAG<br>
>>-; CHECK:     NULL<br>
>>-; CHECK-NOT: DW_TAG<br>
>>-; CHECK:   NULL<br>
>>-<br>
>>-; Function Attrs: uwtable<br>
>>-define void @_Z2f3ii(i32 %x, i32 %y) #0 {<br>
>>-entry:<br>
>>-  %i.addr.i1 = alloca i32, align 4<br>
>>-  %i.addr.i = alloca i32, align 4<br>
>>-  %x.addr = alloca i32, align 4<br>
>>-  %y.addr = alloca i32, align 4<br>
>>-  store i32 %x, i32* %x.addr, align 4<br>
>>-  call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !15,<br>
>>metadata !16), !dbg !17<br>
>>-  store i32 %y, i32* %y.addr, align 4<br>
>>-  call void @llvm.dbg.declare(metadata i32* %y.addr, metadata !18,<br>
>>metadata !16), !dbg !19<br>
>>-  %0 = load i32* %x.addr, align 4, !dbg !20<br>
>>-  store i32 %0, i32* %i.addr.i, align 4, !dbg !20<br>
>>-  call void @llvm.dbg.declare(metadata i32* %i.addr.i, metadata !21,<br>
>>metadata !16), !dbg !22<br>
>>-  %1 = load i32* %i.addr.i, align 4, !dbg !23<br>
>>-  call void @_Z2f1i(i32 %1), !dbg !23<br>
>>-  %2 = load i32* %y.addr, align 4, !dbg !20<br>
>>-  store i32 %2, i32* %i.addr.i1, align 4, !dbg !20<br>
>>-  call void @llvm.dbg.declare(metadata i32* %i.addr.i1, metadata !21,<br>
>>metadata !16), !dbg !22<br>
>>-  %3 = load i32* %i.addr.i1, align 4, !dbg !23<br>
>>-  call void @_Z2f1i(i32 %3), !dbg !23<br>
>>-  ret void, !dbg !24<br>
>>-}<br>
>>-<br>
>>-; Function Attrs: nounwind readnone<br>
>>-declare void @llvm.dbg.declare(metadata, metadata, metadata) #1<br>
>>-<br>
>>-declare void @_Z2f1i(i32) #2<br>
>>-<br>
>>-attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-<br>
>>elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false"<br>
"no-<br>
>>nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-<br>
>>math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind<br>
readnone }<br>
>>-attributes #2 = { "less-precise-fpmad"="false"<br>
"no-frame-pointer-elim"="true"<br>
>>"no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-<br>
>>math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false"<br>
>>"use-soft-float"="false" }<br>
>>-<br>
>>-!<a href="http://llvm.dbg.cu" target="_blank">llvm.dbg.cu</a> = !{!0}<br>
>>-!llvm.module.flags = !{!12, !13}<br>
>>-!llvm.ident = !{!14}<br>
>>-<br>
>>-!0 = !{!"0x11\004\00clang version 3.6.0<br>
>>\000\00\000\00\001", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ]<br>
>>[/tmp/dbginfo/duplicate_inline.cpp] [DW_LANG_C_plus_plus]<br>
>>-!1 = !{!"duplicate_inline.cpp", !"/tmp/dbginfo"}<br>
>>-!2 = !{}<br>
>>-!3 = !{!4, !9}<br>
>>-!4<br>
>>= !{!"0x2e\00f3\00f3\00_Z2f3ii\008\000\001\000\000\00256\000\008", !1, !5,<br>
>> !6, null, void (i32, i32)* @_Z2f3ii, null, null, !2} ; [<br>
DW_TAG_subprogram ]<br>
>>[line 8] [def] [f3]<br>
>>-!5 = !{!"0x29", !1}    ; [ DW_TAG_file_type ]<br>
>>[/tmp/dbginfo/duplicate_inline.cpp]<br>
>>-!6 = !{!"0x15\00\000\000\000\000\000\000", null, null, null, !7, null,<br>
null,<br>
>>null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0]<br>
[from ]<br>
>>-!7 = !{null, !8, !8}<br>
>>-!8 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ;<br>
>>[ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc<br>
>>DW_ATE_signed]<br>
>>-!9<br>
>>= !{!"0x2e\00f2\00f2\00_Z2f2i\002\000\001\000\000\00256\000\002", !1, !5,<br>
>>!10, null, null, null, null, !2} ; [ DW_TAG_subprogram ] [line 2] [def]<br>
[f2]<br>
>>-!10 = !{!"0x15\00\000\000\000\000\000\000", null, null, null, !11, null,<br>
null,<br>
>>null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0]<br>
[from ]<br>
>>-!11 = !{null, !8}<br>
>>-!12 = !{i32 2, !"Dwarf Version", i32 4}<br>
>>-!13 = !{i32 2, !"Debug Info Version", i32 2}<br>
>>-!14 = !{!"clang version 3.6.0 "}<br>
>>-!15 = !{!"0x101\00x\0016777224\000", !4, !5, !8} ; [ DW_TAG_arg_variable<br>
]<br>
>>[x] [line 8]<br>
>>-!16 = !{!"0x102"}               ; [ DW_TAG_expression ]<br>
>>-!17 = !MDLocation(line: 8, column: 13, scope: !4)<br>
>>-!18 = !{!"0x101\00y\0033554440\000", !4, !5, !8} ; [ DW_TAG_arg_variable<br>
]<br>
>>[y] [line 8]<br>
>>-!19 = !MDLocation(line: 8, column: 20, scope: !4)<br>
>>-!20 = !MDLocation(line: 8, column: 25, scope: !4)<br>
>>-!21 = !{!"0x101\00i\0016777218\000", !9, !5, !8} ; [ DW_TAG_arg_variable<br>
]<br>
>>[i] [line 2]<br>
>>-!22 = !MDLocation(line: 2, column: 51, scope: !9, inlinedAt: !20)<br>
>>-!23 = !MDLocation(line: 2, column: 56, scope: !9, inlinedAt: !20)<br>
>>-!24 = !MDLocation(line: 8, column: 36, scope: !4)<br>
>><br>
>><br>
>>_______________________________________________<br>
>>llvm-commits mailing list<br>
>><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br>
<br>
<br>
<br>
</div></div></blockquote></div><br></div></div>