about summary refs log tree commit diff homepage
path: root/lib/Module
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2013-10-11 10:34:09 -0700
committerCristian Cadar <c.cadar@imperial.ac.uk>2013-10-11 10:34:09 -0700
commitbd233936e40f019e0ab066440dc13398ae6754f6 (patch)
tree1c1dd6f398eb419434f46ab8085fc4ac00b84cd6 /lib/Module
parent310ce83f0d04830a0f80c6a98febbfe87195f37d (diff)
parentcff6f244b5d0d378237c0f675f76a8c4f8cc8557 (diff)
downloadklee-bd233936e40f019e0ab066440dc13398ae6754f6.tar.gz
Merge pull request #40 from antiAgainst/intrinsic-trap
Bugfix: Remove llvm.trap declaration after cleaning all uses.
Diffstat (limited to 'lib/Module')
-rw-r--r--lib/Module/IntrinsicCleaner.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp
index 64a47e1b..56d06d30 100644
--- a/lib/Module/IntrinsicCleaner.cpp
+++ b/lib/Module/IntrinsicCleaner.cpp
@@ -61,6 +61,8 @@ bool IntrinsicCleanerPass::runOnModule(Module &M) {
   for (Module::iterator f = M.begin(), fe = M.end(); f != fe; ++f)
     for (Function::iterator b = f->begin(), be = f->end(); b != be; ++b)
       dirty |= runOnBasicBlock(*b, M);
+    if (Function *Declare = M.getFunction("llvm.trap"))
+      Declare->eraseFromParent();
   return dirty;
 }
 
@@ -210,9 +212,6 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) {
 
         ii->eraseFromParent();
 
-        if (Function *Declare = M.getFunction("llvm.trap"))
-          Declare->eraseFromParent();
-
         dirty = true;
         break;
       }