about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorLei Zhang <antiAgainst@gmail.com>2013-10-08 22:09:56 -0400
committerLei Zhang <antiAgainst@gmail.com>2013-10-08 22:09:56 -0400
commitcff6f244b5d0d378237c0f675f76a8c4f8cc8557 (patch)
tree4f3ced43c8b214a2525386c20be444641da9cc4e
parentfc29e256039d1af4979fd0a5c7170de84b19818b (diff)
downloadklee-cff6f244b5d0d378237c0f675f76a8c4f8cc8557.tar.gz
Remove llvm.trap declaration after cleaning all uses.
-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;
       }