diff options
author | Eli Bendersky <eliben@chromium.org> | 2013-10-11 10:16:26 -0700 |
---|---|---|
committer | Eli Bendersky <eliben@chromium.org> | 2013-10-11 10:16:26 -0700 |
commit | e87e8cd648035ac8e2cda19ce0cfd9d9a6e309fb (patch) | |
tree | efa2c12a9699fffc6e5a4ffc64e8a9b1d22ba802 /test | |
parent | 1763e0545c0ee2748b6dbf4aaa1b4bb9d20a2ef0 (diff) |
Fix bug in rewriting of library calls to intrinsics + new regression test.
The pass gets confused in some cases when library functions get passed to
other functions as arguments, because use_iterator returns the call instruction.
The existing test (rewrite-longjmp-noncall-uses.ll) did not catch this problem
because there a bitcast constexpr was applied to the library function pointer,
and it came up as the use instead of the containing call.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3706
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/26952003
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/NaCl/rewrite-call-with-libfunc-argument.ll | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Transforms/NaCl/rewrite-call-with-libfunc-argument.ll b/test/Transforms/NaCl/rewrite-call-with-libfunc-argument.ll new file mode 100644 index 0000000000..56ee2d2c07 --- /dev/null +++ b/test/Transforms/NaCl/rewrite-call-with-libfunc-argument.ll @@ -0,0 +1,18 @@ +; RUN: opt < %s -rewrite-pnacl-library-calls -S | FileCheck %s + +; See https://code.google.com/p/nativeclient/issues/detail?id=3706 +; Make sure that when @longjmp is used as an argument in a call instruction, +; the rewrite pass does the right thing and doesn't get confused. + +; CHECK: define internal void @longjmp(i64* %env, i32 %val) { + +declare void @longjmp(i64*, i32) + +declare void @somefunc(i32, void (i64*, i32)*, i32) + +define void @foo() { +entry: + call void @somefunc(i32 1, void (i64*, i32)* @longjmp, i32 2) +; CHECK: call void @somefunc(i32 1, void (i64*, i32)* @longjmp, i32 2) + ret void +} |