[cfe-commits] r58376 - /cfe/trunk/Driver/Backend.cpp

Daniel Dunbar daniel at zuster.org
Wed Oct 29 01:50:02 PDT 2008


Author: ddunbar
Date: Wed Oct 29 03:50:02 2008
New Revision: 58376

URL: http://llvm.org/viewvc/llvm-project?rev=58376&view=rev
Log:
Workaround an LLVM bug where inlining functions with debug info breaks
code generation.
 - For now, disable running the always inliner pass (at -O0) if we are
   also generating debug information.

Modified:
    cfe/trunk/Driver/Backend.cpp

Modified: cfe/trunk/Driver/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/Backend.cpp?rev=58376&r1=58375&r2=58376&view=diff

==============================================================================
--- cfe/trunk/Driver/Backend.cpp (original)
+++ cfe/trunk/Driver/Backend.cpp Wed Oct 29 03:50:02 2008
@@ -46,6 +46,8 @@
     CompileOptions CompileOpts;
     const std::string &InputFile;
     std::string OutputFile;
+    bool GenerateDebugInfo;
+
     llvm::OwningPtr<CodeGenerator> Gen;
     
     llvm::Module *TheModule;
@@ -76,11 +78,12 @@
     BackendConsumer(BackendAction action, Diagnostic &Diags, 
                     const LangOptions &Features, const CompileOptions &compopts,
                     const std::string& infile, const std::string& outfile,
-                    bool GenerateDebugInfo)  :
+                    bool debug)  :
       Action(action), 
       CompileOpts(compopts),
       InputFile(infile), 
       OutputFile(outfile), 
+      GenerateDebugInfo(debug),
       Gen(CreateLLVMCodeGen(Diags, Features, InputFile, GenerateDebugInfo)),
       TheModule(0), TheTargetData(0), AsmOutStream(0), ModuleProvider(0),
       CodeGenPasses(0), PerModulePasses(0), PerFunctionPasses(0) {}
@@ -304,7 +307,10 @@
     if (CompileOpts.OptimizationLevel > 1 && CompileOpts.UnitAtATime)
       PM->add(createConstantMergePass());         // Merge dup global constants 
   } else {
-    PM->add(createAlwaysInlinerPass());  
+    // FIXME: Remove this once LLVM doesn't break when inlining
+    // functions with debug info.
+    if (!GenerateDebugInfo)
+      PM->add(createAlwaysInlinerPass());  
   }
 }
 





More information about the cfe-commits mailing list