diff options
author | Mark Seaborn <mseaborn@chromium.org> | 2013-09-05 18:13:16 -0700 |
---|---|---|
committer | Mark Seaborn <mseaborn@chromium.org> | 2013-09-05 18:13:16 -0700 |
commit | b6cff79ccb02a23475733459ad3d1f2e8c7ab8f9 (patch) | |
tree | 23ff5ea7ced28771f5ff4dde3ce356ee8c5980c9 | |
parent | cd4a14419f49fb236d65e5b69d871d6fc61fcb99 (diff) |
PNaCl bitcode: Change test to use an intrinsic to make it more realistic
Pointer-typed arguments are only allowed for intrinsics, so change the
test of pointer-args to call an intrinsic.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671
TEST=call-elide.ll
Review URL: https://codereview.chromium.org/23735008
-rw-r--r-- | test/NaCl/Bitcode/call-elide.ll | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/test/NaCl/Bitcode/call-elide.ll b/test/NaCl/Bitcode/call-elide.ll index d7b93516cd..acc4b47a9c 100644 --- a/test/NaCl/Bitcode/call-elide.ll +++ b/test/NaCl/Bitcode/call-elide.ll @@ -20,7 +20,7 @@ @bytes = internal global [4 x i8] c"abcd" declare void @foo(i32 %i) -declare i32 @bar(i32* %i) +declare i32 @llvm.nacl.setjmp(i8* %i) ; ------------------------------------------------------ ; Test how we handle a direct call. @@ -54,32 +54,30 @@ define void @DirectCall() { ; ------------------------------------------------------ ; Test how we handle a direct call with a normalized inttoptr argument. -; Note: This code doesn't follow the PNaCl ABI in that function -; calls can't get pointer arguments. However, intrinsic calls can, and -; this code is a placeholder for such a test. +; Pointer arguments are only allowed for intrinsic calls. define void @DirectCallIntToPtrArg(i32 %i) { - %1 = inttoptr i32 %i to i32* - %2 = call i32 @bar(i32* %1) + %1 = inttoptr i32 %i to i8* + %2 = call i32 @llvm.nacl.setjmp(i8* %1) ret void } ; TD1: define void @DirectCallIntToPtrArg(i32 %i) { -; TD1-NEXT: %1 = inttoptr i32 %i to i32* -; TD1-NEXT: %2 = call i32 @bar(i32* %1) +; TD1-NEXT: %1 = inttoptr i32 %i to i8* +; TD1-NEXT: %2 = call i32 @llvm.nacl.setjmp(i8* %1) ; TD1-NEXT: ret void ; TD1-NEXT: } ; PF1: <FUNCTION_BLOCK> ; PF1-NEXT: <DECLAREBLOCKS op0=1/> -; PF1-NEXT: <INST_CAST op0=1 op1=4 op2=10/> +; PF1-NEXT: <INST_CAST op0=1 op1={{.*}} op2=10/> ; PF1-NEXT: <INST_CALL op0=0 op1=14 op2=1/> ; PF1-NEXT: <INST_RET/> ; PF1: </FUNCTION_BLOCK> ; TD2: define void @DirectCallIntToPtrArg(i32 %i) { -; TD2-NEXT: %1 = inttoptr i32 %i to i32* -; TD2-NEXT: %2 = call i32 @bar(i32* %1) +; TD2-NEXT: %1 = inttoptr i32 %i to i8* +; TD2-NEXT: %2 = call i32 @llvm.nacl.setjmp(i8* %1) ; TD2-NEXT: ret void ; TD2-NEXT: } @@ -91,6 +89,7 @@ define void @DirectCallIntToPtrArg(i32 %i) { ; ------------------------------------------------------ ; Test how we handle a direct call with a normalized ptroint argument. +; Pointer arguments are only allowed for intrinsic calls. define void @DirectCallPtrToIntArg() { %1 = alloca i8, i32 4, align 8 @@ -132,27 +131,27 @@ define void @DirectCallPtrToIntArg() { ; Test how we handle a direct call with a normalized bitcast argument. define void @DirectCallBitcastArg(i32 %i) { - %1 = bitcast [4 x i8]* @bytes to i32* - %2 = call i32 @bar(i32* %1) + %1 = bitcast [4 x i8]* @bytes to i8* + %2 = call i32 @llvm.nacl.setjmp(i8* %1) ret void } ; TD1: define void @DirectCallBitcastArg(i32 %i) { -; TD1-NEXT: %1 = bitcast [4 x i8]* @bytes to i32* -; TD1-NEXT: %2 = call i32 @bar(i32* %1) +; TD1-NEXT: %1 = bitcast [4 x i8]* @bytes to i8* +; TD1-NEXT: %2 = call i32 @llvm.nacl.setjmp(i8* %1) ; TD1-NEXT: ret void ; TD1-NEXT: } ; PF1: <FUNCTION_BLOCK> ; PF1-NEXT: <DECLAREBLOCKS op0=1/> -; PF1-NEXT: <INST_CAST op0=2 op1=4 op2=11/> +; PF1-NEXT: <INST_CAST op0=2 op1={{.*}} op2=11/> ; PF1-NEXT: <INST_CALL op0=0 op1=14 op2=1/> ; PF1-NEXT: <INST_RET/> ; PF1: </FUNCTION_BLOCK> ; TD2: define void @DirectCallBitcastArg(i32 %i) { -; TD2-NEXT: %1 = bitcast [4 x i8]* @bytes to i32* -; TD2-NEXT: %2 = call i32 @bar(i32* %1) +; TD2-NEXT: %1 = bitcast [4 x i8]* @bytes to i8* +; TD2-NEXT: %2 = call i32 @llvm.nacl.setjmp(i8* %1) ; TD2-NEXT: ret void ; TD2-NEXT: } |