1; RUN: opt < %s -pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM 2; RUN: opt < %s -passes=pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM 3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4target triple = "x86_64-unknown-linux-gnu" 5 6@foo = common global i32 (i32, ...)* null, align 8 7 8define i32 @va_func(i32 %num, ...) { 9entry: 10 ret i32 0 11} 12 13define i32 @bar() #1 { 14entry: 15 %tmp = load i32 (i32, ...)*, i32 (i32, ...)** @foo, align 8 16; ICALL-PROM: [[BITCAST:%[0-9]+]] = bitcast i32 (i32, ...)* %tmp to i8* 17; ICALL-PROM: [[CMP:%[0-9]+]] = icmp eq i8* [[BITCAST]], bitcast (i32 (i32, ...)* @va_func to i8*) 18; ICALL-PROM: br i1 [[CMP]], label %if.true.direct_targ, label %if.false.orig_indirect, !prof [[BRANCH_WEIGHT:![0-9]+]] 19; ICALL-PROM:if.true.direct_targ: 20; ICALL-PROM: [[DIRCALL_RET:%[0-9]+]] = call i32 (i32, ...) @va_func(i32 3, i32 12, i32 22, i32 4) 21; ICALL-PROM: br label %if.end.icp 22 %call = call i32 (i32, ...) %tmp(i32 3, i32 12, i32 22, i32 4), !prof !1 23; ICALL-PROM:if.false.orig_indirect: 24; ICALL-PROM: %call = call i32 (i32, ...) %tmp(i32 3, i32 12, i32 22, i32 4) 25; ICALL-PROM: br label %if.end.icp 26 ret i32 %call 27; ICALL-PROM:if.end.icp: 28; ICALL-PROM: [[PHI_RET:%[0-9]+]] = phi i32 [ %call, %if.false.orig_indirect ], [ [[DIRCALL_RET]], %if.true.direct_targ ] 29; ICALL-PROM: ret i32 [[PHI_RET]] 30 31} 32 33!1 = !{!"VP", i32 0, i64 12345, i64 989055279648259519, i64 12345} 34; ICALL-PROM: [[BRANCH_WEIGHT]] = !{!"branch_weights", i32 12345, i32 0} 35