<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 7, 2017, at 9:52 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Tue, Mar 7, 2017 at 9:40 AM Adrian Prantl via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">Author: adrian<br class="gmail_msg">Date: Tue Mar  7 11:28:54 2017<br class="gmail_msg">New Revision: 297161<br class="gmail_msg"><br class="gmail_msg">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=297161&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project?rev=297161&view=rev</a><br class="gmail_msg">Log:<br class="gmail_msg">Relax the conflicting function arg verifier to allow for inlined debug<br class="gmail_msg">info in nodebug functions.<br class="gmail_msg"><br class="gmail_msg">Added:<br class="gmail_msg">   <span class="Apple-converted-space"> </span>llvm/trunk/test/Verifier/fnarg-nodebug.ll<br class="gmail_msg">Modified:<br class="gmail_msg">   <span class="Apple-converted-space"> </span>llvm/trunk/lib/IR/Verifier.cpp<br class="gmail_msg"><br class="gmail_msg">Modified: llvm/trunk/lib/IR/Verifier.cpp<br class="gmail_msg">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=297161&r1=297160&r2=297161&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=297161&r1=297160&r2=297161&view=diff</a><br class="gmail_msg">==============================================================================<br class="gmail_msg">--- llvm/trunk/lib/IR/Verifier.cpp (original)<br class="gmail_msg">+++ llvm/trunk/lib/IR/Verifier.cpp Tue Mar  7 11:28:54 2017<br class="gmail_msg">@@ -277,6 +277,9 @@ class Verifier : public InstVisitor<Veri<br class="gmail_msg">   /// already.<br class="gmail_msg">   bool SawFrameEscape;<br class="gmail_msg"><br class="gmail_msg">+  /// Whether the current function has a DISubprogram attached to it.<br class="gmail_msg">+  bool HasDebugInfo = false;<br class="gmail_msg">+<br class="gmail_msg">   /// Stores the count of how many objects were passed to llvm.localescape for a<br class="gmail_msg">   /// given function and the largest index passed to llvm.localrecover.<br class="gmail_msg">   DenseMap<Function *, std::pair<unsigned, unsigned>> FrameEscapeInfo;<br class="gmail_msg">@@ -2122,6 +2125,7 @@ void Verifier::visitFunction(const Funct<br class="gmail_msg">         <span class="Apple-converted-space"> </span>"Function is marked as dllimport, but not external.", &F);<br class="gmail_msg"><br class="gmail_msg">   auto *N = F.getSubprogram();<br class="gmail_msg">+  HasDebugInfo = (N != nullptr);<br class="gmail_msg">   if (!N)<br class="gmail_msg"></blockquote><div class=""><br class="">Might be nice to rephrase ^ as "if (HasDebugInfo)" for readability?<br class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">     return;<br class="gmail_msg"><br class="gmail_msg">@@ -4425,6 +4429,12 @@ void Verifier::verifyFragmentExpression(<br class="gmail_msg"> }<br class="gmail_msg"><br class="gmail_msg"> void Verifier::verifyFnArgs(const DbgInfoIntrinsic &I) {<br class="gmail_msg">+  // This function does not take the scope of noninlined function arguments into<br class="gmail_msg">+  // account. Don't run it if current function is nodebug, because it may<br class="gmail_msg">+  // contain inlined debug intrinsics.<br class="gmail_msg">+  if (!HasDebugInfo)<br class="gmail_msg">+    return;<br class="gmail_msg">+<br class="gmail_msg">   DILocalVariable *Var;<br class="gmail_msg">   if (auto *DV = dyn_cast<DbgValueInst>(&I)) {<br class="gmail_msg">     // For performance reasons only check non-inlined ones.<br class="gmail_msg"><br class="gmail_msg">Added: llvm/trunk/test/Verifier/fnarg-nodebug.ll<br class="gmail_msg">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/fnarg-nodebug.ll?rev=297161&view=auto" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/fnarg-nodebug.ll?rev=297161&view=auto</a><br class="gmail_msg">==============================================================================<br class="gmail_msg">--- llvm/trunk/test/Verifier/fnarg-nodebug.ll (added)<br class="gmail_msg">+++ llvm/trunk/test/Verifier/fnarg-nodebug.ll Tue Mar  7 11:28:54 2017<br class="gmail_msg">@@ -0,0 +1,70 @@<br class="gmail_msg">+; RUN: llvm-as < %s -o %t<br class="gmail_msg">+; RUN: llvm-dis < %t -o - | FileCheck %s<br class="gmail_msg">+; Created at -02 from:<br class="gmail_msg">+; bool alpha(int);<br class="gmail_msg">+; bool bravo(int charlie) { return (alpha(charlie)); }<br class="gmail_msg">+; static int delta(int charlie) { return charlie + 1; }<br class="gmail_msg">+; __attribute__((nodebug)) bool echo(int foxtrot) {<br class="gmail_msg">+;   return (bravo(delta(foxtrot)));<br class="gmail_msg">+; }<br class="gmail_msg"></blockquote><div class=""><br class="">Rather than using -O2, I usually try to add alwaysinline attributes to the relevant functions to simplify the test (though the need for parameters in this test case may make it a bit nice to have it optimized anyway to simplify that code)<br class=""></div></div></div></div></blockquote><div><br class=""></div>Yes & yes.<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote"><div class=""><br class="">Also there's some extra () around both the return-of-function call in that example text.<br class=""></div></div></div></div></blockquote><div><br class=""></div><div>Removed in 297170.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote"><div class="">Any particular reason delta needs to be static?<br class=""></div></div></div></div></blockquote><div><br class=""></div><div>It probably doesn't matter.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote"><div class="">& why are delta and bravo required, rather than only one inlined function?<br class=""></div></div></div></div></blockquote><div><br class=""></div><div>I copied and pasted this testcase from PR32042 without attempting to reduce it further since the IR already seemed small enough.</div><div><br class=""></div><div>-- adrian</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">+<br class="gmail_msg">+source_filename = "t.c"<br class="gmail_msg">+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"<br class="gmail_msg">+target triple = "x86_64-apple-macosx10.12.0"<br class="gmail_msg">+<br class="gmail_msg">+define zeroext i1 @_Z5bravoi(i32 %charlie) local_unnamed_addr #0 !dbg !7 {<br class="gmail_msg">+entry:<br class="gmail_msg">+  tail call void @llvm.dbg.value(metadata i32 %charlie, i64 0, metadata !13, metadata !14), !dbg !15<br class="gmail_msg">+  %call = tail call zeroext i1 @_Z5alphai(i32 %charlie), !dbg !16<br class="gmail_msg">+  ret i1 %call, !dbg !17<br class="gmail_msg">+}<br class="gmail_msg">+<br class="gmail_msg">+declare zeroext i1 @_Z5alphai(i32) local_unnamed_addr<br class="gmail_msg">+<br class="gmail_msg">+define zeroext i1 @_Z4echoi(i32 %foxtrot) local_unnamed_addr #0 {<br class="gmail_msg">+entry:<br class="gmail_msg">+; This should not set off the FnArg Verifier. The two variables are in differrent scopes.<br class="gmail_msg">+  tail call void @llvm.dbg.value(metadata i32 %foxtrot, i64 0, metadata !18, metadata !14), !dbg !23<br class="gmail_msg">+  %add.i = add nsw i32 %foxtrot, 1, !dbg !24<br class="gmail_msg">+  tail call void @llvm.dbg.value(metadata i32 %add.i, i64 0, metadata !13, metadata !14), !dbg !15<br class="gmail_msg">+  %call.i = tail call zeroext i1 @_Z5alphai(i32 %add.i), !dbg !16<br class="gmail_msg">+  ret i1 %call.i<br class="gmail_msg">+}<br class="gmail_msg">+<br class="gmail_msg">+; Function Attrs: nounwind readnone<br class="gmail_msg">+declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2<br class="gmail_msg">+<br class="gmail_msg">+attributes #0 = { ssp uwtable }<br class="gmail_msg">+attributes #2 = { nounwind readnone }<br class="gmail_msg">+<br class="gmail_msg">+!<a href="http://llvm.dbg.cu/" rel="noreferrer" class="gmail_msg" target="_blank">llvm.dbg.cu</a><span class="Apple-converted-space"> </span>= !{!0}<br class="gmail_msg">+!llvm.module.flags = !{!3, !4, !5}<br class="gmail_msg">+!llvm.ident = !{!6}<br class="gmail_msg">+<br class="gmail_msg">+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 297153) (llvm/trunk 297155)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)<br class="gmail_msg">+!1 = !DIFile(filename: "t.c", directory: "/tmp")<br class="gmail_msg">+!2 = !{}<br class="gmail_msg">+!3 = !{i32 2, !"Dwarf Version", i32 4}<br class="gmail_msg">+!4 = !{i32 2, !"Debug Info Version", i32 3}<br class="gmail_msg">+!5 = !{i32 1, !"PIC Level", i32 2}<br class="gmail_msg">+!6 = !{!"clang version 5.0.0 (trunk 297153) (llvm/trunk 297155)"}<br class="gmail_msg">+!7 = distinct !DISubprogram(name: "bravo", linkageName: "_Z5bravoi", scope: !1, file: !1, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !12)<br class="gmail_msg">+!8 = !DISubroutineType(types: !9)<br class="gmail_msg">+!9 = !{!10, !11}<br class="gmail_msg">+!10 = !DIBasicType(name: "bool", size: 8, encoding: DW_ATE_boolean)<br class="gmail_msg">+!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)<br class="gmail_msg">+!12 = !{!13}<br class="gmail_msg">+; CHECK: !DILocalVariable(name: "charlie", arg: 1<br class="gmail_msg">+!13 = !DILocalVariable(name: "charlie", arg: 1, scope: !7, file: !1, line: 2, type: !11)<br class="gmail_msg">+!14 = !DIExpression()<br class="gmail_msg">+!15 = !DILocation(line: 2, column: 16, scope: !7)<br class="gmail_msg">+!16 = !DILocation(line: 2, column: 35, scope: !7)<br class="gmail_msg">+!17 = !DILocation(line: 2, column: 27, scope: !7)<br class="gmail_msg">+; CHECK: !DILocalVariable(name: "charlie", arg: 1<br class="gmail_msg">+!18 = !DILocalVariable(name: "charlie", arg: 1, scope: !19, file: !1, line: 3, type: !11)<br class="gmail_msg">+!19 = distinct !DISubprogram(name: "delta", linkageName: "_ZL5deltai", scope: !1, file: !1, line: 3, type: !20, isLocal: true, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !22)<br class="gmail_msg">+!20 = !DISubroutineType(types: !21)<br class="gmail_msg">+!21 = !{!11, !11}<br class="gmail_msg">+!22 = !{!18}<br class="gmail_msg">+!23 = !DILocation(line: 3, column: 22, scope: !19)<br class="gmail_msg">+!24 = !DILocation(line: 3, column: 48, scope: !19)<br class="gmail_msg"><br class="gmail_msg"><br class="gmail_msg">_______________________________________________<br class="gmail_msg">llvm-commits mailing list<br class="gmail_msg"><a href="mailto:llvm-commits@lists.llvm.org" class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a><br class="gmail_msg"><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a></blockquote></div></div></div></blockquote></div><br class=""></body></html>