r253595 - Update clang tests to accomendate discriminator changes.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 15:52:22 PST 2015


On Thu, Nov 19, 2015 at 2:38 PM, Dehao Chen <dehao at google.com> wrote:

> I'm not quite familiar with the pass manager, but the stack trace for
> the AddDiscriminators call from the frontend run (with
> -disable-llvm-optzns) is:
>

*looks around*

Oh, that's lame:

  // Handle disabling of LLVM optimization, where we want to preserve the
  // internal module before any optimization.
  if (CodeGenOpts.DisableLLVMOpts) {
    OptLevel = 0;
    Inlining = CodeGenOpts.NoInlining;
  }

It doesn't /actually/ disable LLVM optimizations... it just turns off the
inliner and switches to -O0. *eyeroll*

I wonder what the history is here... *goes spelunking*

Yep, seems to have been there since it was added... in r72742

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)

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))

But there's -disable-llvm-passes. That seems to do the trick. Could you try
that?

- David


>
> #0  (anonymous namespace)::AddDiscriminators::runOnFunction
> (this=0x8924170, F=...) at
> /ssd/llvm_trunk/lib/Transforms/Utils/AddDiscriminators.cpp:177
> #1  0x0000000002769946 in llvm::FPPassManager::runOnFunction
> (this=0x8921380, F=...) at
> /ssd/llvm_trunk/lib/IR/LegacyPassManager.cpp:1521
> #2  0x00000000027696d8 in llvm::legacy::FunctionPassManagerImpl::run
> (this=0x891ee90, F=...) at
> /ssd/llvm_trunk/lib/IR/LegacyPassManager.cpp:1470
> #3  0x00000000027692aa in llvm::legacy::FunctionPassManager::run
> (this=0x88e6a60, F=...) at
> /ssd/llvm_trunk/lib/IR/LegacyPassManager.cpp:1394
> #4  0x0000000002dcd9c2 in (anonymous
> namespace)::EmitAssemblyHelper::EmitAssembly (this=0x7fffffffbd80,
> Action=clang::Backend_EmitLL, OS=0x88b04a0) at
> /ssd/llvm_trunk/tools/clang/lib/CodeGen/
> BackendUtil.cpp:643
> #5  0x0000000002dcdb7a in clang::EmitBackendOutput (Diags=...,
> CGOpts=..., TOpts=..., LOpts=..., TDesc=..., M=0x88b8810,
> Action=clang::Backend_EmitLL, OS=0x88b04a0) at /ssd/llvm_trunk/tools/c
> lang/lib/CodeGen/BackendUtil.cpp:666
> #6  0x00000000035f64b7 in
> clang::BackendConsumer::HandleTranslationUnit (this=0x88b83f0, C=...)
> at /ssd/llvm_trunk/tools/clang/lib/CodeGen/CodeGenAction.cpp:191
> #7  0x0000000003e9aa19 in clang::ParseAST (S=..., PrintStats=false,
> SkipFunctionBodies=false) at
> /ssd/llvm_trunk/tools/clang/lib/Parse/ParseAST.cpp:168
> #8  0x000000000325deec in clang::ASTFrontendAction::ExecuteAction
> (this=0x8887530) at
> /ssd/llvm_trunk/tools/clang/lib/Frontend/FrontendAction.cpp:539
> #9  0x00000000035f5572 in clang::CodeGenAction::ExecuteAction
> (this=0x8887530) at
> /ssd/llvm_trunk/tools/clang/lib/CodeGen/CodeGenAction.cpp:797
> #10 0x000000000325d9b1 in clang::FrontendAction::Execute
> (this=0x8887530) at
> /ssd/llvm_trunk/tools/clang/lib/Frontend/FrontendAction.cpp:439
> #11 0x00000000032176e6 in clang::CompilerInstance::ExecuteAction
> (this=0x8884410, Act=...) at
> /ssd/llvm_trunk/tools/clang/lib/Frontend/CompilerInstance.cpp:841
> #12 0x000000000335c64a in clang::ExecuteCompilerInvocation
> (Clang=0x8884410) at
>
> /ssd/llvm_trunk/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:222
> #13 0x00000000014847d1 in cc1_main (Argv=..., Argv0=0x7fffffffdffd
> "/ssd/llvm_trunk/build.debug/bin/clang", MainAddr=0x1478abe
> <GetExecutablePath(char const*, bool)>) at /ssd/llvm_trunk/tools
> /clang/tools/driver/cc1_main.cpp:116
> #14 0x000000000147af89 in ExecuteCC1Tool (argv=..., Tool=...) at
> /ssd/llvm_trunk/tools/clang/tools/driver/driver.cpp:301
> #15 0x000000000147b938 in main (argc_=12, argv_=0x7fffffffdbf8) at
> /ssd/llvm_trunk/tools/clang/tools/driver/driver.cpp:366
>
> On Thu, Nov 19, 2015 at 1:16 PM, David Blaikie <dblaikie at gmail.com> wrote:
> >
> > On Thu, Nov 19, 2015 at 1:09 PM, Dehao Chen <dehao at google.com> wrote:
> >>
> >> disable-llvm-optzns does not help:
> >>
> >> /ssd/llvm_trunk/build.gccopt/./bin/clang -cc1 -internal-isystem
> >> /ssd/llvm_trunk/build.gccopt/bin/../lib/clang/3.8.0/include
> >> -nostdsysteminc -dwarf-version=4 -debug-info-kind=line-tables-only
> >> -disable-llvm-optzns  -emit-llvm <
> >> /ssd/llvm_trunk/tools/clang/test/CodeGen/debug-info-scope.c
> >>
> >> This still emits discriminators.
> >
> >
> > Do you know where the discriminators are coming from in this case? Does
> the
> > frontend add some of them (in which case the test case shouldn't need
> > updating for your recent backend change still, hopefully)? Is there some
> > other codepath that is running the AddDiscriminator transformation?
> >
> >>
> >>
> >> On Thu, Nov 19, 2015 at 12:46 PM, David Blaikie <dblaikie at gmail.com>
> >> wrote:
> >> >
> >> >
> >> > On Thu, Nov 19, 2015 at 12:42 PM, Dehao Chen <dehao at google.com>
> wrote:
> >> >>
> >> >> Yes, as discriminator is a backend pass, it should *not* affect
> >> >> frontend
> >> >> tests.
> >> >
> >> >
> >> > Could you update these tests to not involve discriminators by passing
> >> > -disable-llvm-optzns instead?
> >> >
> >> >>
> >> >>
> >> >> On Thu, Nov 19, 2015 at 12:36 PM, David Blaikie <dblaikie at gmail.com>
> >> >> wrote:
> >> >> >
> >> >> >
> >> >> > On Thu, Nov 19, 2015 at 11:53 AM, Dehao Chen via cfe-commits
> >> >> > <cfe-commits at lists.llvm.org> wrote:
> >> >> >>
> >> >> >> Author: dehao
> >> >> >> Date: Thu Nov 19 13:53:16 2015
> >> >> >> New Revision: 253595
> >> >> >>
> >> >> >> URL: http://llvm.org/viewvc/llvm-project?rev=253595&view=rev
> >> >> >> Log:
> >> >> >> Update clang tests to accomendate discriminator changes.
> >> >> >>
> >> >> >> Summary: The discriminator change in
> http://reviews.llvm.org/D14738
> >> >> >> will
> >> >> >> fail these clang tests. Update the test to accomendate the
> >> >> >> discriminator
> >> >> >> change.
> >> >> >
> >> >> >
> >> >> > Do these tests need to be testing discriminators in the frontend?
> >> >> > Could
> >> >> > we
> >> >> > just -mllvm -disable-llvm-optzns on these tests? (can the
> >> >> > functionality
> >> >> > be
> >> >> > wholely tested in LLVM, I assume so if it's phrased as an LLVM
> >> >> > transformation pass?)
> >> >> >
> >> >> >>
> >> >> >>
> >> >> >> Reviewers: dblaikie, davidxl, dnovillo
> >> >> >>
> >> >> >> Differential Revision: http://reviews.llvm.org/D14836
> >> >> >>
> >> >> >> Modified:
> >> >> >>     cfe/trunk/test/CodeGen/debug-info-scope.c
> >> >> >>     cfe/trunk/test/CodeGenObjC/arc-linetable.m
> >> >> >>
> >> >> >> Modified: cfe/trunk/test/CodeGen/debug-info-scope.c
> >> >> >> URL:
> >> >> >>
> >> >> >>
> >> >> >>
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-scope.c?rev=253595&r1=253594&r2=253595&view=diff
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> ==============================================================================
> >> >> >> --- cfe/trunk/test/CodeGen/debug-info-scope.c (original)
> >> >> >> +++ cfe/trunk/test/CodeGen/debug-info-scope.c Thu Nov 19 13:53:16
> >> >> >> 2015
> >> >> >> @@ -10,6 +10,7 @@ int main() {
> >> >> >>
> >> >> >>  // GMLT-NOT: !DILexicalBlock
> >> >> >>  // GMLT: !DILexicalBlockFile({{.*}}, discriminator: 1)
> >> >> >> +// GMLT: !DILexicalBlockFile({{.*}}, discriminator: 2)
> >> >> >>  // Make sure we don't have any more lexical blocks because we
> don't
> >> >> >> need
> >> >> >> them in
> >> >> >>  // -gmlt.
> >> >> >>  // GMLT-NOT: !DILexicalBlock
> >> >> >>
> >> >> >> Modified: cfe/trunk/test/CodeGenObjC/arc-linetable.m
> >> >> >> URL:
> >> >> >>
> >> >> >>
> >> >> >>
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-linetable.m?rev=253595&r1=253594&r2=253595&view=diff
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> ==============================================================================
> >> >> >> --- cfe/trunk/test/CodeGenObjC/arc-linetable.m (original)
> >> >> >> +++ cfe/trunk/test/CodeGenObjC/arc-linetable.m Thu Nov 19 13:53:16
> >> >> >> 2015
> >> >> >> @@ -34,9 +34,9 @@
> >> >> >>
> >> >> >>  // CHECK: define {{.*}}testCleanupVoid
> >> >> >>  // CHECK: icmp ne {{.*}}!dbg ![[SKIP1:[0-9]+]]
> >> >> >> -// CHECK: store i32 0, i32* {{.*}}, !dbg ![[RET8:[0-9]+]]
> >> >> >> +// CHECK: store i32 0, i32* {{.*}}, !dbg ![[STORE8:[0-9]+]]
> >> >> >>  // CHECK: @objc_storeStrong{{.*}}, !dbg ![[ARC8:[0-9]+]]
> >> >> >> -// CHECK: ret {{.*}} !dbg ![[RET8]]
> >> >> >> +// CHECK: ret {{.*}} !dbg ![[RET8:[0-9]+]]
> >> >> >>
> >> >> >>  typedef signed char BOOL;
> >> >> >>
> >> >> >> @@ -112,8 +112,9 @@ typedef signed char BOOL;
> >> >> >>        [delegate testVoid :s];
> >> >> >>      }
> >> >> >>    }
> >> >> >> -  // CHECK: ![[RET8]] = !DILocation(line: [[@LINE+2]], scope:
> >> >> >> -  // CHECK: ![[ARC8]] = !DILocation(line: [[@LINE+1]], scope:
> >> >> >> +  // CHECK: ![[STORE8]] = !DILocation(line: [[@LINE+3]], scope:
> >> >> >> +  // CHECK: ![[ARC8]] = !DILocation(line: [[@LINE+2]], scope:
> >> >> >> +  // CHECK: ![[RET8]] = !DILocation(line: [[@LINE+1]], scope:
> >> >> >>  }
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> _______________________________________________
> >> >> >> cfe-commits mailing list
> >> >> >> cfe-commits at lists.llvm.org
> >> >> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> >> >> >
> >> >> >
> >> >
> >> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151119/729e15ca/attachment.html>


More information about the llvm-commits mailing list