Implement a FIXME. This improves codegen just a tad.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83221 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 6451256..0b38684 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -1088,7 +1088,7 @@
// The llvm optimizer and code generator are not yet ready to support
// optimized code debugging.
const CompileOptions &CO = M->getCompileOpts();
- if (CO.OptimizationLevel)
+ if (CO.OptimizationLevel || Builder.GetInsertBlock() == 0)
return;
uint64_t XOffset = 0;
@@ -1269,7 +1269,7 @@
Decl->getNameAsString(), Unit, Line, Ty,
addr);
// Insert an llvm.dbg.declare into the current block.
- DebugFactory.InsertDeclare(Storage, D, Builder.GetInsertBlock());
+ DebugFactory.InsertDeclare(Storage, D, Builder.GetInsertPoint());
}
void CGDebugInfo::EmitDeclareOfAutoVariable(const VarDecl *Decl,