1; RUN: opt -S -pgo-icall-prom -icp-total-percent-threshold=0 -icp-max-prom=4 < %s 2>&1 | FileCheck %s 2 3; Test that CallPromotionUtils will promote calls which require pointer casts. 4 5@foo = common global i64 (i64)* null, align 8 6 7; Check ptrcast arguments. 8define i64 @func1(i8* %a) { 9 ret i64 undef 10} 11 12; Check ptrcast return. 13define i8* @func2(i64 %a) { 14 ret i8* undef 15} 16 17; Check ptrcast arguments and return. 18define i8* @func3(i8 *%a) { 19 ret i8* undef 20} 21 22; Check mixed ptrcast and bitcast. 23define i8* @func4(double %f) { 24 ret i8* undef 25} 26 27define i64 @bar() { 28 %tmp = load i64 (i64)*, i64 (i64)** @foo, align 8 29 30; CHECK: [[ARG:%[0-9]+]] = bitcast i64 1 to double 31; CHECK-NEXT: [[RET:%[0-9]+]] = call i8* @func4(double [[ARG]]) 32; CHECK-NEXT: ptrtoint i8* [[RET]] to i64 33 34; CHECK: [[RET:%[0-9]+]] = call i8* @func2(i64 1) 35; CHECK-NEXT: ptrtoint i8* [[RET]] to i64 36 37; CHECK: [[ARG:%[0-9]+]] = inttoptr i64 1 to i8* 38; CHECK-NEXT: [[RET:%[0-9]+]] = call i8* @func3(i8* [[ARG]]) 39; CHECK-NEXT: ptrtoint i8* [[RET]] to i64 40 41; CHECK: [[ARG:%[0-9]+]] = inttoptr i64 1 to i8* 42; CHECK-NEXT: call i64 @func1(i8* [[ARG]]) 43; CHECK-NOT: ptrtoint 44; CHECK-NOT: bitcast 45 46 %call = call i64 %tmp(i64 1), !prof !1 47 ret i64 %call 48} 49 50!1 = !{!"VP", i32 0, i64 1600, i64 7651369219802541373, i64 1030, i64 -4377547752858689819, i64 410, i64 -6929281286627296573, i64 150, i64 -2545542355363006406, i64 10} 51