aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/Module
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Module')
-rw-r--r--lib/Module/Checks.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Module/Checks.cpp b/lib/Module/Checks.cpp
index 79fd4afc..bf37eea2 100644
--- a/lib/Module/Checks.cpp
+++ b/lib/Module/Checks.cpp
@@ -82,8 +82,13 @@ bool DivCheckPass::runOnModule(Module &M) {
NULL);
divZeroCheckFunction = cast<Function>(fc);
}
-
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 0)
+ CallInst * ci =
+#endif
CallInst::Create(divZeroCheckFunction, denominator, "", &*i);
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 0)
+ ci->setDebugLoc(binOp->getDebugLoc());
+#endif
moduleChanged = true;
}
}
@@ -139,7 +144,9 @@ bool OvershiftCheckPass::runOnModule(Module &M) {
// Inject CallInstr to check if overshifting possible
#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 0)
- CallInst::Create(overshiftCheckFunction, args, "", &*i);
+ CallInst * ci = CallInst::Create(overshiftCheckFunction, args, "", &*i);
+ // set debug information from binary operand to preserve it
+ ci->setDebugLoc(binOp->getDebugLoc());
#else
CallInst::Create(overshiftCheckFunction, args.begin(), args.end(), "", &*i);
#endif