From 90f41303c60195a3c1109c02cf3455d21894e387 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Wed, 29 Oct 2008 08:50:02 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58376 91177308-0d34-0410-b5e6-96231b3b80d8 --- Driver/Backend.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Driver/Backend.cpp b/Driver/Backend.cpp index fe26f1170c..dbe46fcf2f 100644 --- a/Driver/Backend.cpp +++ b/Driver/Backend.cpp @@ -46,6 +46,8 @@ namespace { CompileOptions CompileOpts; const std::string &InputFile; std::string OutputFile; + bool GenerateDebugInfo; + llvm::OwningPtr Gen; llvm::Module *TheModule; @@ -76,11 +78,12 @@ namespace { 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 @@ void BackendConsumer::CreatePasses() { 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()); } } -- 2.40.0