diff options
-rw-r--r-- | lib/Transforms/NaCl/ReplacePtrsWithInts.cpp | 3 | ||||
-rw-r--r-- | test/Transforms/NaCl/pnacl-abi-simplify-postopt.ll | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/Transforms/NaCl/ReplacePtrsWithInts.cpp b/lib/Transforms/NaCl/ReplacePtrsWithInts.cpp index 6e8c6915e5..cee574296f 100644 --- a/lib/Transforms/NaCl/ReplacePtrsWithInts.cpp +++ b/lib/Transforms/NaCl/ReplacePtrsWithInts.cpp @@ -610,6 +610,9 @@ bool ReplacePtrsWithInts::runOnModule(Module &M) { // various casts. for (Module::iterator Func = M.begin(), E = M.end(); Func != E; ++Func) { CleanUpFunction(Func, IntPtrType); + // Delete the now-unused bitcast ConstantExprs that we created so + // that they don't interfere with StripDeadPrototypes. + Func->removeDeadConstantUsers(); } return true; } diff --git a/test/Transforms/NaCl/pnacl-abi-simplify-postopt.ll b/test/Transforms/NaCl/pnacl-abi-simplify-postopt.ll index a1ea6dc0ca..87a4f48dd5 100644 --- a/test/Transforms/NaCl/pnacl-abi-simplify-postopt.ll +++ b/test/Transforms/NaCl/pnacl-abi-simplify-postopt.ll @@ -1,4 +1,6 @@ ; RUN: opt %s -pnacl-abi-simplify-postopt -S | FileCheck %s +; RUN: opt %s -pnacl-abi-simplify-postopt -S \ +; RUN: | FileCheck %s -check-prefix=CLEANUP ; "-pnacl-abi-simplify-postopt" runs various passes which are tested ; thoroughly in other *.ll files. This file is a smoke test to check @@ -14,3 +16,7 @@ define i16 @read_var() { } ; CHECK: = bitcast [4 x i8]* @var ; CHECK-NEXT: load i16* + +; Check that dead prototypes are successfully removed. +declare void @unused_prototype(i8*) +; CLEANUP-NOT: unused_prototype |