aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms
diff options
context:
space:
mode:
authorMark Seaborn <mseaborn@chromium.org>2013-06-04 17:18:01 -0700
committerMark Seaborn <mseaborn@chromium.org>2013-06-04 17:18:01 -0700
commit51c0650c7bb78fed8ce0aba537312aea17f58d7d (patch)
tree1d19c01c79b858427a95b37862d47c393de3fbf6 /test/Transforms
parenta4dba98995121b623698f1b8951da71e17ec634d (diff)
PNaCl: Enable RewritePNaClLibraryCalls and fix it to remove unused decls
Removing the unused declarations of setjmp()/longjmp() will be necessary for future ABI checks which will reject these external function declarations because they are not intrinsics. StripDeadPrototypes is supposed to remove these declarations, but it fails to do so because there are dead ConstantExprs referencing the declarations. I suspect these are left behind by ReplacePtrsWithInts. We could fix this by adding calls to removeDeadConstantUsers() to StripDeadPrototypes or to ReplacePtrsWithInts, but for now it seems cleaner to fix RewritePNaClLibraryCalls. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3429 TEST=*.ll tests + tested along with an ABI check Review URL: https://codereview.chromium.org/15931009
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/NaCl/rewrite-longjmp-no-store.ll5
-rw-r--r--test/Transforms/NaCl/rewrite-setlongjmp-calls.ll4
2 files changed, 8 insertions, 1 deletions
diff --git a/test/Transforms/NaCl/rewrite-longjmp-no-store.ll b/test/Transforms/NaCl/rewrite-longjmp-no-store.ll
index fa2cd3b620..134593ad39 100644
--- a/test/Transforms/NaCl/rewrite-longjmp-no-store.ll
+++ b/test/Transforms/NaCl/rewrite-longjmp-no-store.ll
@@ -1,9 +1,12 @@
; RUN: opt < %s -rewrite-pnacl-library-calls -S | FileCheck %s
+; RUN: opt < %s -rewrite-pnacl-library-calls -S | FileCheck %s -check-prefix=CLEANED
; Test that when there are no uses other than calls to longjmp,
; no function body is generated.
declare void @longjmp(i64*, i32)
-; CHECK-NOT: define{{.*}}@longjmp(i64* %env, i32 %val) {
+
+; No declaration or definition of longjmp() should remain.
+; CLEANED-NOT: @longjmp
define void @call_longjmp(i64* %arg, i32 %num) {
call void @longjmp(i64* %arg, i32 %num)
diff --git a/test/Transforms/NaCl/rewrite-setlongjmp-calls.ll b/test/Transforms/NaCl/rewrite-setlongjmp-calls.ll
index 6ce3294244..f34f004d7f 100644
--- a/test/Transforms/NaCl/rewrite-setlongjmp-calls.ll
+++ b/test/Transforms/NaCl/rewrite-setlongjmp-calls.ll
@@ -1,9 +1,13 @@
; RUN: opt < %s -rewrite-pnacl-library-calls -S | FileCheck %s
+; RUN: opt < %s -rewrite-pnacl-library-calls -S | FileCheck %s -check-prefix=CLEANED
; Test the RewritePNaClLibraryCalls pass
declare i32 @setjmp(i64*)
declare void @longjmp(i64*, i32)
+; No declaration or definition of setjmp() should remain.
+; CLEANED-NOT: @setjmp
+
; Since the address of longjmp is being taken here, a body is generated
; for it, which does a cast and calls an intrinsic