1 ; Test upgrade of ptr.annotation intrinsics.
3 ; RUN: llvm-dis < %s.bc | FileCheck %s
6 ; The arguments passed to the intrinisic wouldn't normally be arguments to
7 ; the function, but that makes it easier to test that they are handled
9 define void @f1(i8* %arg0, i8* %arg1, i8* %arg2, i32 %arg3) {
10 ;CHECK: @f1(i8* [[ARG0:%.*]], i8* [[ARG1:%.*]], i8* [[ARG2:%.*]], i32 [[ARG3:%.*]])
11 %t0 = call i8* @llvm.ptr.annotation.p0i8(i8* %arg0, i8* %arg1, i8* %arg2, i32 %arg3)
12 ;CHECK: call i8* @llvm.ptr.annotation.p0i8(i8* [[ARG0]], i8* [[ARG1]], i8* [[ARG2]], i32 [[ARG3]], i8* null)
14 %arg0_p16 = bitcast i8* %arg0 to i16*
15 %t1 = call i16* @llvm.ptr.annotation.p0i16(i16* %arg0_p16, i8* %arg1, i8* %arg2, i32 %arg3)
16 ;CHECK: [[ARG0_P16:%.*]] = bitcast
17 ;CHECK: call i16* @llvm.ptr.annotation.p0i16(i16* [[ARG0_P16]], i8* [[ARG1]], i8* [[ARG2]], i32 [[ARG3]], i8* null)
19 %arg0_p256 = bitcast i8* %arg0 to i256*
20 %t2 = call i256* @llvm.ptr.annotation.p0i256(i256* %arg0_p256, i8* %arg1, i8* %arg2, i32 %arg3)
21 ;CHECK: [[ARG0_P256:%.*]] = bitcast
22 ;CHECK: call i256* @llvm.ptr.annotation.p0i256(i256* [[ARG0_P256]], i8* [[ARG1]], i8* [[ARG2]], i32 [[ARG3]], i8* null)
27 define i16* @f2(i16* %x, i16* %y) {
28 %t0 = call i16* @llvm.ptr.annotation.p0i16(i16* %x, i8* undef, i8* undef, i32 undef)
29 %t1 = call i16* @llvm.ptr.annotation.p0i16(i16* %y, i8* undef, i8* undef, i32 undef)
30 %cmp = icmp ugt i16* %t0, %t1
31 %sel = select i1 %cmp, i16* %t0, i16* %t1
33 ; CHECK: [[T0:%.*]] = call i16* @llvm.ptr.annotation.p0i16(i16* %x, i8* undef, i8* undef, i32 undef, i8* null)
34 ; CHECK: [[T1:%.*]] = call i16* @llvm.ptr.annotation.p0i16(i16* %y, i8* undef, i8* undef, i32 undef, i8* null)
35 ; CHECK: %cmp = icmp ugt i16* [[T0]], [[T1]]
36 ; CHECK: %sel = select i1 %cmp, i16* [[T0]], i16* [[T1]]
37 ; CHECK: ret i16* %sel
40 declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32)
41 ; CHECK: declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32, i8*)
42 declare i16* @llvm.ptr.annotation.p0i16(i16*, i8*, i8*, i32)
43 ; CHECK: declare i16* @llvm.ptr.annotation.p0i16(i16*, i8*, i8*, i32, i8*)
44 declare i256* @llvm.ptr.annotation.p0i256(i256*, i8*, i8*, i32)
45 ; CHECK: declare i256* @llvm.ptr.annotation.p0i256(i256*, i8*, i8*, i32, i8*)