summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-03-30 21:36:43 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-03-30 21:36:43 +0000
commit0d68b4c5ed89f1c8a9e4466badf69de159ee20d7 (patch)
treee2a4aa5f1b2ed0f7a569f6a352772d15adaeed9a /llvm/lib/IR
parent4bd905e9c524925247b0b6a651117a342cc5db68 (diff)
downloadbcm5719-llvm-0d68b4c5ed89f1c8a9e4466badf69de159ee20d7.tar.gz
bcm5719-llvm-0d68b4c5ed89f1c8a9e4466badf69de159ee20d7.zip
Fix PR23045.
Keep a note in the materializer that we are stripping debug info so that user doing a lazy read of the module don't hit outdated formats. Thanks to Duncan for suggesting the fix. llvm-svn: 233603
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/DebugInfo.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index d772583ba6e..bc40907ba18 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -25,6 +25,7 @@
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
+#include "llvm/IR/GVMaterializer.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/Support/Debug.h"
@@ -945,6 +946,19 @@ template <> DITypeRef DIDescriptor::getFieldAs<DITypeRef>(unsigned Elt) const {
return DITypeRef(cast_or_null<Metadata>(getField(DbgNode, Elt)));
}
+bool llvm::stripDebugInfo(Function &F) {
+ bool Changed = false;
+ for (BasicBlock &BB : F) {
+ for (Instruction &I : BB) {
+ if (I.getDebugLoc()) {
+ Changed = true;
+ I.setDebugLoc(DebugLoc());
+ }
+ }
+ }
+ return Changed;
+}
+
bool llvm::StripDebugInfo(Module &M) {
bool Changed = false;
@@ -978,16 +992,11 @@ bool llvm::StripDebugInfo(Module &M) {
}
}
- for (Function &F : M) {
- for (BasicBlock &BB : F) {
- for (Instruction &I : BB) {
- if (I.getDebugLoc()) {
- Changed = true;
- I.setDebugLoc(DebugLoc());
- }
- }
- }
- }
+ for (Function &F : M)
+ Changed |= stripDebugInfo(F);
+
+ if ( GVMaterializer *Materializer = M.getMaterializer())
+ Materializer->setStripDebugInfo();
return Changed;
}
OpenPOWER on IntegriCloud