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

Side by Side Diff: test/Transforms/NaCl/rewrite-libcalls-wrong-signature.ll

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 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 ; Check how the pass behaves in the presence of library functions with wrong
3 ; signatures.
4
5 declare i8 @longjmp(i64)
6
7 @flongjmp = global i8 (i64)* @longjmp
8 ; CHECK: @flongjmp = global i8 (i64)* bitcast (void (i64*, i32)* @longjmp to i8 (i64)*)
9
10 ; CHECK: define internal void @longjmp(i64* %env, i32 %val)
11
12 declare i8* @memcpy(i32)
13
14 define i8* @call_bad_memcpy(i32 %arg) {
15 %result = call i8* @memcpy(i32 %arg)
16 ret i8* %result
17 }
18
19 ; CHECK: define i8* @call_bad_memcpy(i32 %arg) {
20 ; CHECK: %result = call i8* bitcast (i8* (i8*, i8*, i32)* @memcpy to i8* (i32) *)(i32 %arg)
21
22 declare i8 @setjmp()
23
24 ; This simulates a case where the original C file had a correct setjmp
25 ; call but due to linking order a wrong declaration made it into the
26 ; IR. In this case, the correct call is bitcasted to the correct type.
27 ; The pass should treat this properly by creating a direct intrinsic
28 ; call instead of going through the wrapper.
29 define i32 @call_valid_setjmp(i64* %buf) {
30 %result = call i32 bitcast (i8 ()* @setjmp to i32 (i64*)*)(i64* %buf)
31 ret i32 %result
32 }
33
34 ; CHECK: define i32 @call_valid_setjmp(i64* %buf) {
35 ; CHECK-NEXT: %jmp_buf_i8 = bitcast i64* %buf to i8*
36 ; CHECK-NEXT: %result = call i32 @llvm.nacl.setjmp(i8* %jmp_buf_i8)
37 ; CHECK-NEXT: ret i32 %result
38 ; CHECK-NEXT: }
OLDNEW
« no previous file with comments | « test/Transforms/NaCl/rewrite-flt-rounds.ll ('k') | test/Transforms/NaCl/rewrite-longjmp-no-store.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698