Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: test/Transforms/NaCl/rewrite-setlongjmp-calls.ll

Issue 14617017: Adding a pass - RewritePNaClLibraryCalls, that replaces known library calls with stable bitcode int… (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 ; RUN: opt < %s -rewrite-pnacl-library-calls -S | FileCheck %s
2 ; Test the RewritePNaClLibraryCalls pass
3
4 declare i32 @setjmp(i64*)
jvoung (off chromium) 2013/05/10 16:42:49 CHECK that it now declares the llvm.nacl.setjmp an
eliben 2013/05/10 23:39:52 Done.
eliben 2013/05/10 23:39:52 Done.
5 declare void @longjmp(i64*, i32)
6
7 define i32 @call_setjmp(i64* %arg) {
8 ; CHECK-NOT: call i32 @setjmp
9 ; CHECK: %jmp_buf_i8 = bitcast i64* %arg to i8*
10 ; CHECK-NEXT: call i32 @llvm.nacl.setjmp(i8* %jmp_buf_i8)
Mark Seaborn 2013/05/10 16:34:36 Make this: "%val = call"
eliben 2013/05/10 23:39:52 Done.
11 %val = call i32 @setjmp(i64* %arg)
12 ret i32 %val
13 }
14
15 define void @call_longjmp(i64* %arg, i32 %num) {
16 ; CHECK-NOT: call void @longjmp
17 ; CHECK: %jmp_buf_i8 = bitcast i64* %arg to i8*
18 ; CHECK-NEXT: call void @llvm.nacl.longjmp(i8* %jmp_buf_i8, i32 %num)
19 call void @longjmp(i64* %arg, i32 %num)
20 ret void
21 }
22
23 ; A more complex example with a number of calls in several BBs
24 define void @multiple_calls(i64* %arg, i32 %num) {
25 entryblock:
26 ; CHECK: entryblock
27 ; CHECK: bitcast
28 ; CHECK-NEXT: call void @llvm.nacl.longjmp
29 call void @longjmp(i64* %arg, i32 %num)
jvoung (off chromium) 2013/05/10 16:42:49 This function doesn't quite have the "normal" usag
eliben 2013/05/10 23:39:52 Yes, these tests (and the pass, really) have nothi
30 br label %block1
31 block1:
32 ; CHECK: block1
33 ; CHECK: bitcast
34 ; CHECK-NEXT: call void @llvm.nacl.longjmp
35 call void @longjmp(i64* %arg, i32 %num)
36 ; CHECK: call i32 @llvm.nacl.setjmp
37 %val = call i32 @setjmp(i64* %arg)
38 %num2 = add i32 %val, %num
39 ; CHECK: bitcast
40 ; CHECK-NEXT: call void @llvm.nacl.longjmp
41 call void @longjmp(i64* %arg, i32 %num2)
42 br label %exitblock
43 exitblock:
44 %num3 = add i32 %num, %num
45 call void @longjmp(i64* %arg, i32 %num3)
46 %num4 = add i32 %num, %num3
47 ; CHECK: bitcast
48 ; CHECK-NEXT: call void @llvm.nacl.longjmp
49 call void @longjmp(i64* %arg, i32 %num4)
50 ret void
51 }
52
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698