<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 20, 2015 at 12:11 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On 2015-Nov-19, at 15:52, David Blaikie via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
><br>
><br>
><br>
> On Thu, Nov 19, 2015 at 2:38 PM, Dehao Chen <<a href="mailto:dehao@google.com">dehao@google.com</a>> wrote:<br>
> I'm not quite familiar with the pass manager, but the stack trace for<br>
> the AddDiscriminators call from the frontend run (with<br>
> -disable-llvm-optzns) is:<br>
><br>
> *looks around*<br>
><br>
> Oh, that's lame:<br>
><br>
>   // Handle disabling of LLVM optimization, where we want to preserve the<br>
>   // internal module before any optimization.<br>
>   if (CodeGenOpts.DisableLLVMOpts) {<br>
>     OptLevel = 0;<br>
>     Inlining = CodeGenOpts.NoInlining;<br>
>   }<br>
><br>
> It doesn't /actually/ disable LLVM optimizations... it just turns off the inliner and switches to -O0. *eyeroll*<br>
><br>
> I wonder what the history is here... *goes spelunking*<br>
><br>
> Yep, seems to have been there since it was added... in r72742<br>
><br>
> We really should fix that. It really shouldn't run the LLVM optimization pipeline at all. (you know, because that's what it says on the tin)<br>
><br>
> Hmm, OK, maybe it does make sense-ish (disable-llvm-optzns is for disabling /optimizations/? But that's still arguably... (always inlining isn't strictly an optimization))<br>
><br>
> But there's -disable-llvm-passes. That seems to do the trick. Could you try that?<br>
<br>
</span>I think -disable-llvm-optzns at one point disabled all the passes,<br></blockquote><div><br></div><div>My spelunking seemed to indicate that it had always just caused the LLVM pipeline to be -O0 no inlining, I didn't see any hint that it used to skip the pipeline entirely - but it's possible I didn't look far enough to find that.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
but then some of the sanitizers were skipping it.  When we included<br>
an IR dump in -save-temps, we noticed it wasn't working correctly<br>
and Steven Wu added the less muddy -disable-llvm-passes in r242565.<br>
<br>
I wouldn't have a problem with -disable-llvm-optzns skipping all<br>
passes (again?), but I figured the sanitizers avoided it for a<br>
reason?<br></blockquote><div><br></div><div>I'm happy enough with the two - just one of those things I didn't know/had to learn.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5"><br>
><br>
> - David<br>
><br>
><br>
> #0  (anonymous namespace)::AddDiscriminators::runOnFunction<br>
> (this=0x8924170, F=...) at<br>
> /ssd/llvm_trunk/lib/Transforms/Utils/AddDiscriminators.cpp:177<br>
> #1  0x0000000002769946 in llvm::FPPassManager::runOnFunction<br>
> (this=0x8921380, F=...) at<br>
> /ssd/llvm_trunk/lib/IR/LegacyPassManager.cpp:1521<br>
> #2  0x00000000027696d8 in llvm::legacy::FunctionPassManagerImpl::run<br>
> (this=0x891ee90, F=...) at<br>
> /ssd/llvm_trunk/lib/IR/LegacyPassManager.cpp:1470<br>
> #3  0x00000000027692aa in llvm::legacy::FunctionPassManager::run<br>
> (this=0x88e6a60, F=...) at<br>
> /ssd/llvm_trunk/lib/IR/LegacyPassManager.cpp:1394<br>
> #4  0x0000000002dcd9c2 in (anonymous<br>
> namespace)::EmitAssemblyHelper::EmitAssembly (this=0x7fffffffbd80,<br>
> Action=clang::Backend_EmitLL, OS=0x88b04a0) at<br>
> /ssd/llvm_trunk/tools/clang/lib/CodeGen/<br>
> BackendUtil.cpp:643<br>
> #5  0x0000000002dcdb7a in clang::EmitBackendOutput (Diags=...,<br>
> CGOpts=..., TOpts=..., LOpts=..., TDesc=..., M=0x88b8810,<br>
> Action=clang::Backend_EmitLL, OS=0x88b04a0) at /ssd/llvm_trunk/tools/c<br>
> lang/lib/CodeGen/BackendUtil.cpp:666<br>
> #6  0x00000000035f64b7 in<br>
> clang::BackendConsumer::HandleTranslationUnit (this=0x88b83f0, C=...)<br>
> at /ssd/llvm_trunk/tools/clang/lib/CodeGen/CodeGenAction.cpp:191<br>
> #7  0x0000000003e9aa19 in clang::ParseAST (S=..., PrintStats=false,<br>
> SkipFunctionBodies=false) at<br>
> /ssd/llvm_trunk/tools/clang/lib/Parse/ParseAST.cpp:168<br>
> #8  0x000000000325deec in clang::ASTFrontendAction::ExecuteAction<br>
> (this=0x8887530) at<br>
> /ssd/llvm_trunk/tools/clang/lib/Frontend/FrontendAction.cpp:539<br>
> #9  0x00000000035f5572 in clang::CodeGenAction::ExecuteAction<br>
> (this=0x8887530) at<br>
> /ssd/llvm_trunk/tools/clang/lib/CodeGen/CodeGenAction.cpp:797<br>
> #10 0x000000000325d9b1 in clang::FrontendAction::Execute<br>
> (this=0x8887530) at<br>
> /ssd/llvm_trunk/tools/clang/lib/Frontend/FrontendAction.cpp:439<br>
> #11 0x00000000032176e6 in clang::CompilerInstance::ExecuteAction<br>
> (this=0x8884410, Act=...) at<br>
> /ssd/llvm_trunk/tools/clang/lib/Frontend/CompilerInstance.cpp:841<br>
> #12 0x000000000335c64a in clang::ExecuteCompilerInvocation<br>
> (Clang=0x8884410) at<br>
> /ssd/llvm_trunk/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:222<br>
> #13 0x00000000014847d1 in cc1_main (Argv=..., Argv0=0x7fffffffdffd<br>
> "/ssd/llvm_trunk/build.debug/bin/clang", MainAddr=0x1478abe<br>
> <GetExecutablePath(char const*, bool)>) at /ssd/llvm_trunk/tools<br>
> /clang/tools/driver/cc1_main.cpp:116<br>
> #14 0x000000000147af89 in ExecuteCC1Tool (argv=..., Tool=...) at<br>
> /ssd/llvm_trunk/tools/clang/tools/driver/driver.cpp:301<br>
> #15 0x000000000147b938 in main (argc_=12, argv_=0x7fffffffdbf8) at<br>
> /ssd/llvm_trunk/tools/clang/tools/driver/driver.cpp:366<br>
><br>
> On Thu, Nov 19, 2015 at 1:16 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
> ><br>
> > On Thu, Nov 19, 2015 at 1:09 PM, Dehao Chen <<a href="mailto:dehao@google.com">dehao@google.com</a>> wrote:<br>
> >><br>
> >> disable-llvm-optzns does not help:<br>
> >><br>
> >> /ssd/llvm_trunk/build.gccopt/./bin/clang -cc1 -internal-isystem<br>
> >> /ssd/llvm_trunk/build.gccopt/bin/../lib/clang/3.8.0/include<br>
> >> -nostdsysteminc -dwarf-version=4 -debug-info-kind=line-tables-only<br>
> >> -disable-llvm-optzns  -emit-llvm <<br>
> >> /ssd/llvm_trunk/tools/clang/test/CodeGen/debug-info-scope.c<br>
> >><br>
> >> This still emits discriminators.<br>
> ><br>
> ><br>
> > Do you know where the discriminators are coming from in this case? Does the<br>
> > frontend add some of them (in which case the test case shouldn't need<br>
> > updating for your recent backend change still, hopefully)? Is there some<br>
> > other codepath that is running the AddDiscriminator transformation?<br>
> ><br>
> >><br>
> >><br>
> >> On Thu, Nov 19, 2015 at 12:46 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>><br>
> >> wrote:<br>
> >> ><br>
> >> ><br>
> >> > On Thu, Nov 19, 2015 at 12:42 PM, Dehao Chen <<a href="mailto:dehao@google.com">dehao@google.com</a>> wrote:<br>
> >> >><br>
> >> >> Yes, as discriminator is a backend pass, it should *not* affect<br>
> >> >> frontend<br>
> >> >> tests.<br>
> >> ><br>
> >> ><br>
> >> > Could you update these tests to not involve discriminators by passing<br>
> >> > -disable-llvm-optzns instead?<br>
> >> ><br>
> >> >><br>
> >> >><br>
> >> >> On Thu, Nov 19, 2015 at 12:36 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>><br>
> >> >> wrote:<br>
> >> >> ><br>
> >> >> ><br>
> >> >> > On Thu, Nov 19, 2015 at 11:53 AM, Dehao Chen via cfe-commits<br>
> >> >> > <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br>
> >> >> >><br>
> >> >> >> Author: dehao<br>
> >> >> >> Date: Thu Nov 19 13:53:16 2015<br>
> >> >> >> New Revision: 253595<br>
> >> >> >><br>
> >> >> >> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=253595&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=253595&view=rev</a><br>
> >> >> >> Log:<br>
> >> >> >> Update clang tests to accomendate discriminator changes.<br>
> >> >> >><br>
> >> >> >> Summary: The discriminator change in <a href="http://reviews.llvm.org/D14738" rel="noreferrer" target="_blank">http://reviews.llvm.org/D14738</a><br>
> >> >> >> will<br>
> >> >> >> fail these clang tests. Update the test to accomendate the<br>
> >> >> >> discriminator<br>
> >> >> >> change.<br>
> >> >> ><br>
> >> >> ><br>
> >> >> > Do these tests need to be testing discriminators in the frontend?<br>
> >> >> > Could<br>
> >> >> > we<br>
> >> >> > just -mllvm -disable-llvm-optzns on these tests? (can the<br>
> >> >> > functionality<br>
> >> >> > be<br>
> >> >> > wholely tested in LLVM, I assume so if it's phrased as an LLVM<br>
> >> >> > transformation pass?)<br>
> >> >> ><br>
> >> >> >><br>
> >> >> >><br>
> >> >> >> Reviewers: dblaikie, davidxl, dnovillo<br>
> >> >> >><br>
> >> >> >> Differential Revision: <a href="http://reviews.llvm.org/D14836" rel="noreferrer" target="_blank">http://reviews.llvm.org/D14836</a><br>
> >> >> >><br>
> >> >> >> Modified:<br>
> >> >> >>     cfe/trunk/test/CodeGen/debug-info-scope.c<br>
> >> >> >>     cfe/trunk/test/CodeGenObjC/arc-linetable.m<br>
> >> >> >><br>
> >> >> >> Modified: cfe/trunk/test/CodeGen/debug-info-scope.c<br>
> >> >> >> URL:<br>
> >> >> >><br>
> >> >> >><br>
> >> >> >> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-scope.c?rev=253595&r1=253594&r2=253595&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-scope.c?rev=253595&r1=253594&r2=253595&view=diff</a><br>
> >> >> >><br>
> >> >> >><br>
> >> >> >><br>
> >> >> >> ==============================================================================<br>
> >> >> >> --- cfe/trunk/test/CodeGen/debug-info-scope.c (original)<br>
> >> >> >> +++ cfe/trunk/test/CodeGen/debug-info-scope.c Thu Nov 19 13:53:16<br>
> >> >> >> 2015<br>
> >> >> >> @@ -10,6 +10,7 @@ int main() {<br>
> >> >> >><br>
> >> >> >>  // GMLT-NOT: !DILexicalBlock<br>
> >> >> >>  // GMLT: !DILexicalBlockFile({{.*}}, discriminator: 1)<br>
> >> >> >> +// GMLT: !DILexicalBlockFile({{.*}}, discriminator: 2)<br>
> >> >> >>  // Make sure we don't have any more lexical blocks because we don't<br>
> >> >> >> need<br>
> >> >> >> them in<br>
> >> >> >>  // -gmlt.<br>
> >> >> >>  // GMLT-NOT: !DILexicalBlock<br>
> >> >> >><br>
> >> >> >> Modified: cfe/trunk/test/CodeGenObjC/arc-linetable.m<br>
> >> >> >> URL:<br>
> >> >> >><br>
> >> >> >><br>
> >> >> >> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-linetable.m?rev=253595&r1=253594&r2=253595&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-linetable.m?rev=253595&r1=253594&r2=253595&view=diff</a><br>
> >> >> >><br>
> >> >> >><br>
> >> >> >><br>
> >> >> >> ==============================================================================<br>
> >> >> >> --- cfe/trunk/test/CodeGenObjC/arc-linetable.m (original)<br>
> >> >> >> +++ cfe/trunk/test/CodeGenObjC/arc-linetable.m Thu Nov 19 13:53:16<br>
> >> >> >> 2015<br>
> >> >> >> @@ -34,9 +34,9 @@<br>
> >> >> >><br>
> >> >> >>  // CHECK: define {{.*}}testCleanupVoid<br>
> >> >> >>  // CHECK: icmp ne {{.*}}!dbg ![[SKIP1:[0-9]+]]<br>
> >> >> >> -// CHECK: store i32 0, i32* {{.*}}, !dbg ![[RET8:[0-9]+]]<br>
> >> >> >> +// CHECK: store i32 0, i32* {{.*}}, !dbg ![[STORE8:[0-9]+]]<br>
> >> >> >>  // CHECK: @objc_storeStrong{{.*}}, !dbg ![[ARC8:[0-9]+]]<br>
> >> >> >> -// CHECK: ret {{.*}} !dbg ![[RET8]]<br>
> >> >> >> +// CHECK: ret {{.*}} !dbg ![[RET8:[0-9]+]]<br>
> >> >> >><br>
> >> >> >>  typedef signed char BOOL;<br>
> >> >> >><br>
> >> >> >> @@ -112,8 +112,9 @@ typedef signed char BOOL;<br>
> >> >> >>        [delegate testVoid :s];<br>
> >> >> >>      }<br>
> >> >> >>    }<br>
> >> >> >> -  // CHECK: ![[RET8]] = !DILocation(line: [[@LINE+2]], scope:<br>
> >> >> >> -  // CHECK: ![[ARC8]] = !DILocation(line: [[@LINE+1]], scope:<br>
> >> >> >> +  // CHECK: ![[STORE8]] = !DILocation(line: [[@LINE+3]], scope:<br>
> >> >> >> +  // CHECK: ![[ARC8]] = !DILocation(line: [[@LINE+2]], scope:<br>
> >> >> >> +  // CHECK: ![[RET8]] = !DILocation(line: [[@LINE+1]], scope:<br>
> >> >> >>  }<br>
> >> >> >><br>
> >> >> >><br>
> >> >> >><br>
> >> >> >><br>
> >> >> >> _______________________________________________<br>
> >> >> >> cfe-commits mailing list<br>
> >> >> >> <a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
> >> >> >> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
> >> >> ><br>
> >> >> ><br>
> >> ><br>
> >> ><br>
> ><br>
> ><br>
><br>
</div></div>> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br>
</blockquote></div><br></div></div>