18 changes: 9 additions & 9 deletions llvm/test/Transforms/PGOProfile/memop_profile_funclet.ll
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $"??_C@_0BC@CABPINND@Exception?5caught?$AA?$AA@" = comdat any
@"?msg@@3PADA" = dso_local global [200 x i8] zeroinitializer, align 16
@"??_C@_0BC@CABPINND@Exception?5caught?$AA?$AA@" = linkonce_odr dso_local unnamed_addr constant [18 x i8] c"0123456789012345\00\00", comdat, align 1

define dso_local void @"?run@@YAXH@Z"(i32 %count) personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
define dso_local void @"?run@@YAXH@Z"(i32 %count) personality ptr @__CxxFrameHandler3 {
entry:
invoke void @"?may_throw@@YAXH@Z"(i32 %count)
to label %try.cont unwind label %catch.dispatch
Expand All @@ -41,14 +41,14 @@ catch.dispatch: ; preds = %entry
%tmp = catchswitch within none [label %catch] unwind to caller

catch: ; preds = %catch.dispatch
%tmp1 = catchpad within %tmp [i8* null, i32 64, i8* null]
%tmp2 = load i32, i32* @"?len@@3IA", align 4
%tmp1 = catchpad within %tmp [ptr null, i32 64, ptr null]
%tmp2 = load i32, ptr @"?len@@3IA", align 4
%conv = zext i32 %tmp2 to i64
call void @llvm.memcpy.p0i8.p0i8.i64(
i8* getelementptr inbounds ([200 x i8], [200 x i8]* @"?msg@@3PADA", i64 0, i64 0),
i8* getelementptr inbounds ([18 x i8], [18 x i8]* @"??_C@_0BC@CABPINND@Exception?5caught?$AA?$AA@", i64 0, i64 0),
call void @llvm.memcpy.p0.p0.i64(
ptr @"?msg@@3PADA",
ptr @"??_C@_0BC@CABPINND@Exception?5caught?$AA?$AA@",
i64 %conv, i1 false)
call void @_CxxThrowException(i8* null, %eh.ThrowInfo* null) #3 [ "funclet"(token %tmp1) ]
call void @_CxxThrowException(ptr null, ptr null) #3 [ "funclet"(token %tmp1) ]
unreachable

try.cont: ; preds = %entry
Expand All @@ -66,5 +66,5 @@ try.cont: ; preds = %entry
declare dso_local void @"?may_throw@@YAXH@Z"(i32)
declare dso_local i32 @__CxxFrameHandler3(...)

declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i1)
declare dso_local void @_CxxThrowException(i8*, %eh.ThrowInfo*)
declare void @llvm.memcpy.p0.p0.i64(ptr, ptr, i64, i1)
declare dso_local void @_CxxThrowException(ptr, ptr)
28 changes: 14 additions & 14 deletions llvm/test/Transforms/PGOProfile/memop_size_annotation.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define void @foo(i8* %dst, i8* %src, i32* %a, i32 %n) {
define void @foo(ptr %dst, ptr %src, ptr %a, i32 %n) {
entry:
br label %for.cond

Expand All @@ -20,22 +20,22 @@ for.body:
for.cond1:
%j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
%idx.ext = sext i32 %i.0 to i64
%add.ptr = getelementptr inbounds i32, i32* %a, i64 %idx.ext
%0 = load i32, i32* %add.ptr, align 4
%add.ptr = getelementptr inbounds i32, ptr %a, i64 %idx.ext
%0 = load i32, ptr %add.ptr, align 4
%cmp2 = icmp slt i32 %j.0, %0
br i1 %cmp2, label %for.body3, label %for.end

for.body3:
%add = add nsw i32 %i.0, 1
%conv = sext i32 %add to i64
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %conv, i1 false)
; MEMOP_ANNOTATION: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %conv, i1 false)
call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %conv, i1 false)
; MEMOP_ANNOTATION: call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %conv, i1 false)
; MEMOP_ANNOTATION-SAME: !prof ![[MEMOP_VALUESITE:[0-9]+]]
%memcmp = call i32 @memcmp(i8* %dst, i8* %src, i64 %conv)
; MEMOP_ANNOTATION: call i32 @memcmp(i8* %dst, i8* %src, i64 %conv)
%memcmp = call i32 @memcmp(ptr %dst, ptr %src, i64 %conv)
; MEMOP_ANNOTATION: call i32 @memcmp(ptr %dst, ptr %src, i64 %conv)
; MEMOP_ANNOTATION-SAME: !prof ![[MEMOP_VALUESITE]]
%bcmp = call i32 @bcmp(i8* %dst, i8* %src, i64 %conv)
; MEMOP_ANNOTATION: call i32 @bcmp(i8* %dst, i8* %src, i64 %conv)
%bcmp = call i32 @bcmp(ptr %dst, ptr %src, i64 %conv)
; MEMOP_ANNOTATION: call i32 @bcmp(ptr %dst, ptr %src, i64 %conv)
; MEMOP_ANNOTATION-SAME: !prof ![[MEMOP_VALUESITE]]
; MEMOP_ANNOTATION9: ![[MEMOP_VALUESITE]] = !{!"VP", i32 1, i64 556, i64 1, i64 99, i64 2, i64 88, i64 3, i64 77, i64 9, i64 72, i64 4, i64 66, i64 5, i64 55, i64 6, i64 44, i64 7, i64 33, i64 8, i64 22}
; MEMOP_ANNOTATION4: ![[MEMOP_VALUESITE]] = !{!"VP", i32 1, i64 556, i64 1, i64 99, i64 2, i64 88, i64 3, i64 77, i64 9, i64 72}
Expand All @@ -56,11 +56,11 @@ for.end6:
ret void
}

declare void @llvm.lifetime.start(i64, i8* nocapture)
declare void @llvm.lifetime.start(i64, ptr nocapture)

declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1)
declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1)

declare i32 @memcmp(i8*, i8*, i64)
declare i32 @bcmp(i8*, i8*, i64)
declare i32 @memcmp(ptr, ptr, i64)
declare i32 @bcmp(ptr, ptr, i64)

declare void @llvm.lifetime.end(i64, i8* nocapture)
declare void @llvm.lifetime.end(i64, ptr nocapture)
12 changes: 6 additions & 6 deletions llvm/test/Transforms/PGOProfile/memop_size_from_strlen.ll
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s

declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i1)
declare i32 @strlen(i8* nocapture)
declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture readonly, i32, i1)
declare i32 @strlen(ptr nocapture)

; CHECK-LABEL: test
; CHECK: %1 = zext i32 %c to i64
; CHECK: call void @llvm.instrprof.value.profile(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__profn_test, i32 0, i32 0), i64 {{[0-9]+}}, i64 %1, i32 1, i32 0)
; CHECK: call void @llvm.instrprof.value.profile(ptr @__profn_test, i64 {{[0-9]+}}, i64 %1, i32 1, i32 0)

define void @test(i8* %a, i8* %p) {
%c = call i32 @strlen(i8* %p)
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %p, i32 %c, i1 false)
define void @test(ptr %a, ptr %p) {
%c = call i32 @strlen(ptr %p)
call void @llvm.memcpy.p0.p0.i32(ptr %a, ptr %p, i32 %c, i1 false)
ret void
}
46 changes: 23 additions & 23 deletions llvm/test/Transforms/PGOProfile/memop_size_opt.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define void @foo(i8* %dst, i8* %src, i8* %dst2, i8* %src2, i32* %a, i32 %n) !prof !27 {
define void @foo(ptr %dst, ptr %src, ptr %dst2, ptr %src2, ptr %a, i32 %n) !prof !27 {
entry:
br label %for.cond

Expand All @@ -22,36 +22,36 @@ for.body:
for.cond1:
%j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
%idx.ext = sext i32 %i.0 to i64
%add.ptr = getelementptr inbounds i32, i32* %a, i64 %idx.ext
%0 = load i32, i32* %add.ptr, align 4
%add.ptr = getelementptr inbounds i32, ptr %a, i64 %idx.ext
%0 = load i32, ptr %add.ptr, align 4
%cmp2 = icmp slt i32 %j.0, %0
br i1 %cmp2, label %for.body3, label %for.end, !prof !29

for.body3:
%add = add nsw i32 %i.0, 1
%conv = sext i32 %add to i64
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %conv, i1 false), !prof !30
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst2, i8* %src2, i64 %conv, i1 false), !prof !31
call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %conv, i1 false), !prof !30
call void @llvm.memcpy.p0.p0.i64(ptr %dst2, ptr %src2, i64 %conv, i1 false), !prof !31
br label %for.inc

; MEMOP_OPT: switch i64 %conv, label %[[DEFAULT_LABEL:.*]] [
; MEMOP_OPT: i64 0, label %[[CASE_1_LABEL:.*]]
; MEMOP_OPT: ], !prof [[SWITCH_BW:![0-9]+]]
; MEMOP_OPT: [[CASE_1_LABEL]]:
; MEMOP_OPT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 0, i1 false)
; MEMOP_OPT: call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 0, i1 false)
; MEMOP_OPT: br label %[[MERGE_LABEL:.*]]
; MEMOP_OPT: [[DEFAULT_LABEL]]:
; MEMOP_OPT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %conv, i1 false), !prof [[NEWVP:![0-9]+]]
; MEMOP_OPT: call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %conv, i1 false), !prof [[NEWVP:![0-9]+]]
; MEMOP_OPT: br label %[[MERGE_LABEL]]
; MEMOP_OPT: [[MERGE_LABEL]]:
; MEMOP_OPT: switch i64 %conv, label %[[DEFAULT_LABEL2:.*]] [
; MEMOP_OPT: i64 0, label %[[CASE_1_LABEL2:.*]]
; MEMOP_OPT: ], !prof [[SWITCH_BW:![0-9]+]]
; MEMOP_OPT: [[CASE_1_LABEL2]]:
; MEMOP_OPT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst2, i8* %src2, i64 0, i1 false)
; MEMOP_OPT: call void @llvm.memcpy.p0.p0.i64(ptr %dst2, ptr %src2, i64 0, i1 false)
; MEMOP_OPT: br label %[[MERGE_LABEL2:.*]]
; MEMOP_OPT: [[DEFAULT_LABEL2]]:
; MEMOP_OPT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst2, i8* %src2, i64 %conv, i1 false), !prof [[NEWVP]]
; MEMOP_OPT: call void @llvm.memcpy.p0.p0.i64(ptr %dst2, ptr %src2, i64 %conv, i1 false), !prof [[NEWVP]]
; MEMOP_OPT: br label %[[MERGE_LABEL2]]
; MEMOP_OPT: [[MERGE_LABEL2]]:
; MEMOP_OPT: br label %for.inc
Expand All @@ -73,7 +73,7 @@ for.end6:

declare void @consume(i32 %v1, i32 %v2)

define void @foo_memcmp_bcmp(i8* %dst, i8* %src, i8* %dst2, i8* %src2, i32* %a, i32 %n) !prof !27 {
define void @foo_memcmp_bcmp(ptr %dst, ptr %src, ptr %dst2, ptr %src2, ptr %a, i32 %n) !prof !27 {
entry:
br label %for.cond

Expand All @@ -88,38 +88,38 @@ for.body:
for.cond1:
%j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
%idx.ext = sext i32 %i.0 to i64
%add.ptr = getelementptr inbounds i32, i32* %a, i64 %idx.ext
%0 = load i32, i32* %add.ptr, align 4
%add.ptr = getelementptr inbounds i32, ptr %a, i64 %idx.ext
%0 = load i32, ptr %add.ptr, align 4
%cmp2 = icmp slt i32 %j.0, %0
br i1 %cmp2, label %for.body3, label %for.end, !prof !29

for.body3:
%add = add nsw i32 %i.0, 1
%conv = sext i32 %add to i64
%memcmp = call i32 @memcmp(i8* %dst, i8* %src, i64 %conv), !prof !30
%bcmp = call i32 @bcmp(i8* %dst2, i8* %src2, i64 %conv), !prof !31
%memcmp = call i32 @memcmp(ptr %dst, ptr %src, i64 %conv), !prof !30
%bcmp = call i32 @bcmp(ptr %dst2, ptr %src2, i64 %conv), !prof !31
call void @consume(i32 %memcmp, i32 %bcmp)
br label %for.inc

; MEMOP_OPT: switch i64 %conv, label %[[DEFAULT_LABEL:.*]] [
; MEMOP_OPT: i64 0, label %[[CASE_1_LABEL:.*]]
; MEMOP_OPT: ], !prof [[SWITCH_BW:![0-9]+]]
; MEMOP_OPT: [[CASE_1_LABEL]]:
; MEMOP_OPT: %[[RV:.*]] = call i32 @memcmp(i8* %dst, i8* %src, i64 0)
; MEMOP_OPT: %[[RV:.*]] = call i32 @memcmp(ptr %dst, ptr %src, i64 0)
; MEMOP_OPT: br label %[[MERGE_LABEL:.*]]
; MEMOP_OPT: [[DEFAULT_LABEL]]:
; MEMOP_OPT: %[[RVD:.*]] = call i32 @memcmp(i8* %dst, i8* %src, i64 %conv), !prof [[NEWVP:![0-9]+]]
; MEMOP_OPT: %[[RVD:.*]] = call i32 @memcmp(ptr %dst, ptr %src, i64 %conv), !prof [[NEWVP:![0-9]+]]
; MEMOP_OPT: br label %[[MERGE_LABEL]]
; MEMOP_OPT: [[MERGE_LABEL]]:
; MEMOP_OPT: %[[PHI:.*]] = phi i32 [ %[[RVD]], %[[DEFAULT_LABEL]] ], [ %[[RV]], %[[CASE_1_LABEL]] ]
; MEMOP_OPT: switch i64 %conv, label %[[DEFAULT_LABEL2:.*]] [
; MEMOP_OPT: i64 0, label %[[CASE_1_LABEL2:.*]]
; MEMOP_OPT: ], !prof [[SWITCH_BW:![0-9]+]]
; MEMOP_OPT: [[CASE_1_LABEL2]]:
; MEMOP_OPT: %[[RV2:.*]] = call i32 @bcmp(i8* %dst2, i8* %src2, i64 0)
; MEMOP_OPT: %[[RV2:.*]] = call i32 @bcmp(ptr %dst2, ptr %src2, i64 0)
; MEMOP_OPT: br label %[[MERGE_LABEL2:.*]]
; MEMOP_OPT: [[DEFAULT_LABEL2]]:
; MEMOP_OPT: %[[RVD2:.*]] = call i32 @bcmp(i8* %dst2, i8* %src2, i64 %conv), !prof [[NEWVP]]
; MEMOP_OPT: %[[RVD2:.*]] = call i32 @bcmp(ptr %dst2, ptr %src2, i64 %conv), !prof [[NEWVP]]
; MEMOP_OPT: br label %[[MERGE_LABEL2]]
; MEMOP_OPT: [[MERGE_LABEL2]]:
; MEMOP_OPT: %[[PHI2:.*]] = phi i32 [ %[[RVD2]], %[[DEFAULT_LABEL2]] ], [ %[[RV2]], %[[CASE_1_LABEL2]] ]
Expand Down Expand Up @@ -181,14 +181,14 @@ for.end6:
!30 = !{!"VP", i32 1, i64 556, i64 0, i64 99, i64 2, i64 88, i64 3, i64 77, i64 9, i64 72, i64 4, i64 66, i64 5, i64 55, i64 6, i64 44, i64 7, i64 33, i64 8, i64 22}
!31 = !{!"VP", i32 1, i64 556, i64 0, i64 99, i64 2, i64 88, i64 3, i64 77, i64 9, i64 72, i64 4, i64 66, i64 5, i64 55, i64 6, i64 44, i64 7, i64 33, i64 8, i64 22}

declare void @llvm.lifetime.start(i64, i8* nocapture)
declare void @llvm.lifetime.start(i64, ptr nocapture)

declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1)
declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1)

declare i32 @memcmp(i8*, i8*, i64)
declare i32 @bcmp(i8*, i8*, i64)
declare i32 @memcmp(ptr, ptr, i64)
declare i32 @bcmp(ptr, ptr, i64)

declare void @llvm.lifetime.end(i64, i8* nocapture)
declare void @llvm.lifetime.end(i64, ptr nocapture)

; YAML: --- !Passed
; YAML-NEXT: Pass: pgo-memop-opt
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
; RUN: opt < %s -passes=pgo-memop-opt -pgo-memop-count-threshold=100 -pgo-memop-percent-threshold=10 -S | FileCheck %s

define void @foo(i8* %dst, i8* %src, i8* %dst2, i8* %src2, i64 %n) !prof !27 {
define void @foo(ptr %dst, ptr %src, ptr %dst2, ptr %src2, i64 %n) !prof !27 {
entry:
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %n, i1 false), !prof !28
call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %n, i1 false), !prof !28
ret void
}

Expand All @@ -12,16 +12,16 @@ entry:
; CHECK: i64 2, label %[[CASE_2_LABEL:.*]]
; CHECK: ], !prof [[SWITCH_BW:![0-9]+]]
; CHECK: [[CASE_0_LABEL]]:
; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 0, i1 false)
; CHECK: call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 0, i1 false)
; CHECK: br label %[[MERGE_LABEL:.*]]
; CHECK: [[CASE_1_LABEL]]:
; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 1, i1 false)
; CHECK: call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false)
; CHECK: br label %[[MERGE_LABEL:.*]]
; CHECK: [[CASE_2_LABEL]]:
; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 2, i1 false)
; CHECK: call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 2, i1 false)
; CHECK: br label %[[MERGE_LABEL:.*]]
; CHECK: [[DEFAULT_LABEL]]:
; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %n, i1 false), !prof [[NEWVP:![0-9]+]]
; CHECK: call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %n, i1 false), !prof [[NEWVP:![0-9]+]]
; CHECK: br label %[[MERGE_LABEL]]
; CHECK: [[MERGE_LABEL]]:
; CHECK: ret void
Expand All @@ -31,7 +31,7 @@ entry:
; CHECK: [[SWITCH_BW]] = !{!"branch_weights", i32 524, i32 101, i32 101, i32 101}
; CHECK: [[NEWVP]] = !{!"VP", i32 1, i64 524, i64 9, i64 104, i64 17, i64 103, i64 33, i64 103, i64 65, i64 102, i64 129, i64 102, i64 3, i64 101}

declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1)
declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1)

!llvm.module.flags = !{!0}

Expand Down
8 changes: 4 additions & 4 deletions llvm/test/Transforms/PGOProfile/memop_size_opt_zero.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define void @foo(i8* %dst, i8* %src, i64 %conv) !prof !0 {
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %conv, i1 false), !prof !1
define void @foo(ptr %dst, ptr %src, i64 %conv) !prof !0 {
call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %conv, i1 false), !prof !1
ret void
}

; MEMOP_OPT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %conv, i1 false), !prof !1
; MEMOP_OPT: call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %conv, i1 false), !prof !1

!0 = !{!"function_entry_count", i64 1}
!1 = !{!"VP", i32 1, i64 0, i64 1, i64 0, i64 2, i64 0, i64 3, i64 0, i64 9, i64 0, i64 4, i64 0, i64 5, i64 0, i64 6, i64 0, i64 7, i64 0, i64 8, i64 0}

declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1)
declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1)
36 changes: 16 additions & 20 deletions llvm/test/Transforms/PGOProfile/misexpect-branch-correct.ll
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ define i32 @bar() #0 {
entry:
%rando = alloca i32, align 4
%x = alloca i32, align 4
%0 = bitcast i32* %rando to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #4
call void @llvm.lifetime.start.p0(i64 4, ptr %rando) #4
%call = call i32 (...) @buzz()
store i32 %call, i32* %rando, align 4, !tbaa !3
%1 = bitcast i32* %x to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %1) #4
store i32 0, i32* %x, align 4, !tbaa !3
%2 = load i32, i32* %rando, align 4, !tbaa !3
%rem = srem i32 %2, 200000
store i32 %call, ptr %rando, align 4, !tbaa !3
call void @llvm.lifetime.start.p0(i64 4, ptr %x) #4
store i32 0, ptr %x, align 4, !tbaa !3
%0 = load i32, ptr %rando, align 4, !tbaa !3
%rem = srem i32 %0, 200000
%cmp = icmp eq i32 %rem, 0
%lnot = xor i1 %cmp, true
%lnot1 = xor i1 %lnot, true
Expand All @@ -42,27 +40,25 @@ entry:
br i1 %tobool, label %if.then, label %if.else

if.then: ; preds = %entry
%3 = load i32, i32* %rando, align 4, !tbaa !3
%call2 = call i32 @baz(i32 %3)
store i32 %call2, i32* %x, align 4, !tbaa !3
%1 = load i32, ptr %rando, align 4, !tbaa !3
%call2 = call i32 @baz(i32 %1)
store i32 %call2, ptr %x, align 4, !tbaa !3
br label %if.end

if.else: ; preds = %entry
%call3 = call i32 @foo(i32 50)
store i32 %call3, i32* %x, align 4, !tbaa !3
store i32 %call3, ptr %x, align 4, !tbaa !3
br label %if.end

if.end: ; preds = %if.else, %if.then
%4 = load i32, i32* %x, align 4, !tbaa !3
%5 = bitcast i32* %x to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %5) #4
%6 = bitcast i32* %rando to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %6) #4
ret i32 %4
%2 = load i32, ptr %x, align 4, !tbaa !3
call void @llvm.lifetime.end.p0(i64 4, ptr %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr %rando) #4
ret i32 %2
}

; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare i32 @buzz(...) #2

Expand All @@ -74,7 +70,7 @@ declare i32 @baz(i32) #2
declare i32 @foo(i32) #2

; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { argmemonly nounwind willreturn }
Expand Down
36 changes: 16 additions & 20 deletions llvm/test/Transforms/PGOProfile/misexpect-branch-overflow.ll
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ define i32 @bar() #0 !dbg !6 {
entry:
%rando = alloca i32, align 4
%x = alloca i32, align 4
%0 = bitcast i32* %rando to i8*, !dbg !9
call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #4, !dbg !9
call void @llvm.lifetime.start.p0(i64 4, ptr %rando) #4, !dbg !9
%call = call i32 (...) @buzz(), !dbg !9
store i32 %call, i32* %rando, align 4, !dbg !9, !tbaa !10
%1 = bitcast i32* %x to i8*, !dbg !14
call void @llvm.lifetime.start.p0i8(i64 4, i8* %1) #4, !dbg !14
store i32 0, i32* %x, align 4, !dbg !14, !tbaa !10
%2 = load i32, i32* %rando, align 4, !dbg !15, !tbaa !10
%rem = srem i32 %2, 200000, !dbg !15
store i32 %call, ptr %rando, align 4, !dbg !9, !tbaa !10
call void @llvm.lifetime.start.p0(i64 4, ptr %x) #4, !dbg !14
store i32 0, ptr %x, align 4, !dbg !14, !tbaa !10
%0 = load i32, ptr %rando, align 4, !dbg !15, !tbaa !10
%rem = srem i32 %0, 200000, !dbg !15
%cmp = icmp eq i32 %rem, 0, !dbg !15
%lnot = xor i1 %cmp, true, !dbg !15
%lnot1 = xor i1 %lnot, true, !dbg !15
Expand All @@ -39,27 +37,25 @@ entry:
br i1 %tobool, label %if.then, label %if.else, !dbg !15

if.then: ; preds = %entry
%3 = load i32, i32* %rando, align 4, !dbg !16, !tbaa !10
%call2 = call i32 @baz(i32 %3), !dbg !16
store i32 %call2, i32* %x, align 4, !dbg !16, !tbaa !10
%1 = load i32, ptr %rando, align 4, !dbg !16, !tbaa !10
%call2 = call i32 @baz(i32 %1), !dbg !16
store i32 %call2, ptr %x, align 4, !dbg !16, !tbaa !10
br label %if.end, !dbg !17

if.else: ; preds = %entry
%call3 = call i32 @foo(i32 50), !dbg !18
store i32 %call3, i32* %x, align 4, !dbg !18, !tbaa !10
store i32 %call3, ptr %x, align 4, !dbg !18, !tbaa !10
br label %if.end

if.end: ; preds = %if.else, %if.then
%4 = load i32, i32* %x, align 4, !dbg !19, !tbaa !10
%5 = bitcast i32* %x to i8*, !dbg !20
call void @llvm.lifetime.end.p0i8(i64 4, i8* %5) #4, !dbg !20
%6 = bitcast i32* %rando to i8*, !dbg !20
call void @llvm.lifetime.end.p0i8(i64 4, i8* %6) #4, !dbg !20
ret i32 %4, !dbg !19
%2 = load i32, ptr %x, align 4, !dbg !19, !tbaa !10
call void @llvm.lifetime.end.p0(i64 4, ptr %x) #4, !dbg !20
call void @llvm.lifetime.end.p0(i64 4, ptr %rando) #4, !dbg !20
ret i32 %2, !dbg !19
}

; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare i32 @buzz(...) #2

Expand All @@ -71,7 +67,7 @@ declare i32 @baz(i32) #2
declare i32 @foo(i32) #2

; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { argmemonly nounwind willreturn }
Expand Down
36 changes: 16 additions & 20 deletions llvm/test/Transforms/PGOProfile/misexpect-branch-stripped.ll
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ define i32 @bar() #0 {
entry:
%rando = alloca i32, align 4
%x = alloca i32, align 4
%0 = bitcast i32* %rando to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #4
call void @llvm.lifetime.start.p0(i64 4, ptr %rando) #4
%call = call i32 (...) @buzz()
store i32 %call, i32* %rando, align 4, !tbaa !3
%1 = bitcast i32* %x to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %1) #4
store i32 0, i32* %x, align 4, !tbaa !3
%2 = load i32, i32* %rando, align 4, !tbaa !3
%rem = srem i32 %2, 200000
store i32 %call, ptr %rando, align 4, !tbaa !3
call void @llvm.lifetime.start.p0(i64 4, ptr %x) #4
store i32 0, ptr %x, align 4, !tbaa !3
%0 = load i32, ptr %rando, align 4, !tbaa !3
%rem = srem i32 %0, 200000
%cmp = icmp eq i32 %rem, 0
%lnot = xor i1 %cmp, true
%lnot1 = xor i1 %lnot, true
Expand All @@ -52,27 +50,25 @@ entry:
br i1 %tobool, label %if.then, label %if.else

if.then: ; preds = %entry
%3 = load i32, i32* %rando, align 4, !tbaa !3
%call2 = call i32 @baz(i32 %3)
store i32 %call2, i32* %x, align 4, !tbaa !3
%1 = load i32, ptr %rando, align 4, !tbaa !3
%call2 = call i32 @baz(i32 %1)
store i32 %call2, ptr %x, align 4, !tbaa !3
br label %if.end

if.else: ; preds = %entry
%call3 = call i32 @foo(i32 50)
store i32 %call3, i32* %x, align 4, !tbaa !3
store i32 %call3, ptr %x, align 4, !tbaa !3
br label %if.end

if.end: ; preds = %if.else, %if.then
%4 = load i32, i32* %x, align 4, !tbaa !3
%5 = bitcast i32* %x to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %5) #4
%6 = bitcast i32* %rando to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %6) #4
ret i32 %4
%2 = load i32, ptr %x, align 4, !tbaa !3
call void @llvm.lifetime.end.p0(i64 4, ptr %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr %rando) #4
ret i32 %2
}

; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare i32 @buzz(...) #2

Expand All @@ -84,7 +80,7 @@ declare i32 @baz(i32) #2
declare i32 @foo(i32) #2

; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { argmemonly nounwind willreturn }
Expand Down
36 changes: 16 additions & 20 deletions llvm/test/Transforms/PGOProfile/misexpect-branch-unpredictable.ll
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ define i32 @bar() #0 {
entry:
%rando = alloca i32, align 4
%x = alloca i32, align 4
%0 = bitcast i32* %rando to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #3
call void @llvm.lifetime.start.p0(i64 4, ptr %rando) #3
%call = call i32 (...) @buzz()
store i32 %call, i32* %rando, align 4, !tbaa !2
%1 = bitcast i32* %x to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %1) #3
store i32 0, i32* %x, align 4, !tbaa !2
%2 = load i32, i32* %rando, align 4, !tbaa !2
%rem = srem i32 %2, 200000
store i32 %call, ptr %rando, align 4, !tbaa !2
call void @llvm.lifetime.start.p0(i64 4, ptr %x) #3
store i32 0, ptr %x, align 4, !tbaa !2
%0 = load i32, ptr %rando, align 4, !tbaa !2
%rem = srem i32 %0, 200000
%cmp = icmp eq i32 %rem, 0
%lnot = xor i1 %cmp, true
%lnot1 = xor i1 %lnot, true
Expand All @@ -39,27 +37,25 @@ entry:
br i1 %tobool, label %if.then, label %if.else, !unpredictable !6

if.then: ; preds = %entry
%3 = load i32, i32* %rando, align 4, !tbaa !2
%call2 = call i32 @baz(i32 %3)
store i32 %call2, i32* %x, align 4, !tbaa !2
%1 = load i32, ptr %rando, align 4, !tbaa !2
%call2 = call i32 @baz(i32 %1)
store i32 %call2, ptr %x, align 4, !tbaa !2
br label %if.end

if.else: ; preds = %entry
%call3 = call i32 @foo(i32 50)
store i32 %call3, i32* %x, align 4, !tbaa !2
store i32 %call3, ptr %x, align 4, !tbaa !2
br label %if.end

if.end: ; preds = %if.else, %if.then
%4 = load i32, i32* %x, align 4, !tbaa !2
%5 = bitcast i32* %x to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %5) #3
%6 = bitcast i32* %rando to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %6) #3
ret i32 %4
%2 = load i32, ptr %x, align 4, !tbaa !2
call void @llvm.lifetime.end.p0(i64 4, ptr %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr %rando) #3
ret i32 %2
}

; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare i32 @buzz(...) #2

Expand All @@ -68,7 +64,7 @@ declare i32 @baz(i32) #2
declare i32 @foo(i32) #2

; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { argmemonly nounwind willreturn }
Expand Down
36 changes: 16 additions & 20 deletions llvm/test/Transforms/PGOProfile/misexpect-branch.ll
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ define i32 @bar() #0 !dbg !6 {
entry:
%rando = alloca i32, align 4
%x = alloca i32, align 4
%0 = bitcast i32* %rando to i8*, !dbg !9
call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #4, !dbg !9
call void @llvm.lifetime.start.p0(i64 4, ptr %rando) #4, !dbg !9
%call = call i32 (...) @buzz(), !dbg !9
store i32 %call, i32* %rando, align 4, !dbg !9, !tbaa !10
%1 = bitcast i32* %x to i8*, !dbg !14
call void @llvm.lifetime.start.p0i8(i64 4, i8* %1) #4, !dbg !14
store i32 0, i32* %x, align 4, !dbg !14, !tbaa !10
%2 = load i32, i32* %rando, align 4, !dbg !15, !tbaa !10
%rem = srem i32 %2, 200000, !dbg !15
store i32 %call, ptr %rando, align 4, !dbg !9, !tbaa !10
call void @llvm.lifetime.start.p0(i64 4, ptr %x) #4, !dbg !14
store i32 0, ptr %x, align 4, !dbg !14, !tbaa !10
%0 = load i32, ptr %rando, align 4, !dbg !15, !tbaa !10
%rem = srem i32 %0, 200000, !dbg !15
%cmp = icmp eq i32 %rem, 0, !dbg !15
%lnot = xor i1 %cmp, true, !dbg !15
%lnot1 = xor i1 %lnot, true, !dbg !15
Expand All @@ -56,27 +54,25 @@ entry:
br i1 %tobool, label %if.then, label %if.else, !dbg !15

if.then: ; preds = %entry
%3 = load i32, i32* %rando, align 4, !dbg !16, !tbaa !10
%call2 = call i32 @baz(i32 %3), !dbg !16
store i32 %call2, i32* %x, align 4, !dbg !16, !tbaa !10
%1 = load i32, ptr %rando, align 4, !dbg !16, !tbaa !10
%call2 = call i32 @baz(i32 %1), !dbg !16
store i32 %call2, ptr %x, align 4, !dbg !16, !tbaa !10
br label %if.end, !dbg !17

if.else: ; preds = %entry
%call3 = call i32 @foo(i32 50), !dbg !18
store i32 %call3, i32* %x, align 4, !dbg !18, !tbaa !10
store i32 %call3, ptr %x, align 4, !dbg !18, !tbaa !10
br label %if.end

if.end: ; preds = %if.else, %if.then
%4 = load i32, i32* %x, align 4, !dbg !19, !tbaa !10
%5 = bitcast i32* %x to i8*, !dbg !20
call void @llvm.lifetime.end.p0i8(i64 4, i8* %5) #4, !dbg !20
%6 = bitcast i32* %rando to i8*, !dbg !20
call void @llvm.lifetime.end.p0i8(i64 4, i8* %6) #4, !dbg !20
ret i32 %4, !dbg !19
%2 = load i32, ptr %x, align 4, !dbg !19, !tbaa !10
call void @llvm.lifetime.end.p0(i64 4, ptr %x) #4, !dbg !20
call void @llvm.lifetime.end.p0(i64 4, ptr %rando) #4, !dbg !20
ret i32 %2, !dbg !19
}

; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare i32 @buzz(...) #2

Expand All @@ -88,7 +84,7 @@ declare i32 @baz(i32) #2
declare i32 @foo(i32) #2

; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { argmemonly nounwind willreturn }
Expand Down
90 changes: 41 additions & 49 deletions llvm/test/Transforms/PGOProfile/misexpect-switch-default.ll
Original file line number Diff line number Diff line change
Expand Up @@ -40,39 +40,37 @@ target triple = "x86_64-unknown-linux-gnu"
define dso_local void @init_arry() #0 {
entry:
%i = alloca i32, align 4
%0 = bitcast i32* %i to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #6
store i32 0, i32* %i, align 4, !tbaa !4
call void @llvm.lifetime.start.p0(i64 4, ptr %i) #6
store i32 0, ptr %i, align 4, !tbaa !4
br label %for.cond

for.cond: ; preds = %for.inc, %entry
%1 = load i32, i32* %i, align 4, !tbaa !4
%cmp = icmp slt i32 %1, 25
%0 = load i32, ptr %i, align 4, !tbaa !4
%cmp = icmp slt i32 %0, 25
br i1 %cmp, label %for.body, label %for.end

for.body: ; preds = %for.cond
%call = call i32 @rand() #6
%rem = srem i32 %call, 10
%2 = load i32, i32* %i, align 4, !tbaa !4
%idxprom = sext i32 %2 to i64
%arrayidx = getelementptr inbounds [25 x i32], [25 x i32]* @arry, i64 0, i64 %idxprom
store i32 %rem, i32* %arrayidx, align 4, !tbaa !4
%1 = load i32, ptr %i, align 4, !tbaa !4
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [25 x i32], ptr @arry, i64 0, i64 %idxprom
store i32 %rem, ptr %arrayidx, align 4, !tbaa !4
br label %for.inc

for.inc: ; preds = %for.body
%3 = load i32, i32* %i, align 4, !tbaa !4
%inc = add nsw i32 %3, 1
store i32 %inc, i32* %i, align 4, !tbaa !4
%2 = load i32, ptr %i, align 4, !tbaa !4
%inc = add nsw i32 %2, 1
store i32 %inc, ptr %i, align 4, !tbaa !4
br label %for.cond

for.end: ; preds = %for.cond
%4 = bitcast i32* %i to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %4) #6
call void @llvm.lifetime.end.p0(i64 4, ptr %i) #6
ret void
}

; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind readnone speculatable willreturn
declare void @llvm.dbg.declare(metadata, metadata, metadata) #2
Expand All @@ -81,7 +79,7 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) #2
declare dso_local i32 @rand() #3

; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
Expand All @@ -90,29 +88,26 @@ entry:
%val = alloca i32, align 4
%j = alloca i32, align 4
%condition = alloca i32, align 4
store i32 0, i32* %retval, align 4
store i32 0, ptr %retval, align 4
call void @init_arry()
%0 = bitcast i32* %val to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #6
store i32 0, i32* %val, align 4, !tbaa !4
%1 = bitcast i32* %j to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %1) #6
store i32 0, i32* %j, align 4, !tbaa !4
call void @llvm.lifetime.start.p0(i64 4, ptr %val) #6
store i32 0, ptr %val, align 4, !tbaa !4
call void @llvm.lifetime.start.p0(i64 4, ptr %j) #6
store i32 0, ptr %j, align 4, !tbaa !4
br label %for.cond

for.cond: ; preds = %for.inc, %entry
%2 = load i32, i32* %j, align 4, !tbaa !4
%cmp = icmp slt i32 %2, 20000
%0 = load i32, ptr %j, align 4, !tbaa !4
%cmp = icmp slt i32 %0, 20000
br i1 %cmp, label %for.body, label %for.end

for.body: ; preds = %for.cond
%3 = bitcast i32* %condition to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %3) #6
call void @llvm.lifetime.start.p0(i64 4, ptr %condition) #6
%call = call i32 @rand() #6
%rem = srem i32 %call, 5
store i32 %rem, i32* %condition, align 4, !tbaa !4
%4 = load i32, i32* %condition, align 4, !tbaa !4
%conv = zext i32 %4 to i64
store i32 %rem, ptr %condition, align 4, !tbaa !4
%1 = load i32, ptr %condition, align 4, !tbaa !4
%conv = zext i32 %1 to i64
%expval = call i64 @llvm.expect.i64(i64 %conv, i64 6)
switch i64 %expval, label %sw.default [
i64 0, label %sw.bb
Expand All @@ -123,50 +118,47 @@ for.body: ; preds = %for.cond
]

sw.bb: ; preds = %for.body
%call1 = call i32 @sum(i32* getelementptr inbounds ([25 x i32], [25 x i32]* @arry, i64 0, i64 0), i32 25)
%5 = load i32, i32* %val, align 4, !tbaa !4
%add = add nsw i32 %5, %call1
store i32 %add, i32* %val, align 4, !tbaa !4
%call1 = call i32 @sum(ptr @arry, i32 25)
%2 = load i32, ptr %val, align 4, !tbaa !4
%add = add nsw i32 %2, %call1
store i32 %add, ptr %val, align 4, !tbaa !4
br label %sw.epilog

sw.bb2: ; preds = %for.body, %for.body, %for.body
br label %sw.epilog

sw.bb3: ; preds = %for.body
%call4 = call i32 @random_sample(i32* getelementptr inbounds ([25 x i32], [25 x i32]* @arry, i64 0, i64 0), i32 25)
%6 = load i32, i32* %val, align 4, !tbaa !4
%add5 = add nsw i32 %6, %call4
store i32 %add5, i32* %val, align 4, !tbaa !4
%call4 = call i32 @random_sample(ptr @arry, i32 25)
%3 = load i32, ptr %val, align 4, !tbaa !4
%add5 = add nsw i32 %3, %call4
store i32 %add5, ptr %val, align 4, !tbaa !4
br label %sw.epilog

sw.default: ; preds = %for.body
unreachable

sw.epilog: ; preds = %sw.bb3, %sw.bb2, %sw.bb
%7 = bitcast i32* %condition to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %7) #6
call void @llvm.lifetime.end.p0(i64 4, ptr %condition) #6
br label %for.inc

for.inc: ; preds = %sw.epilog
%8 = load i32, i32* %j, align 4, !tbaa !4
%inc = add nsw i32 %8, 1
store i32 %inc, i32* %j, align 4, !tbaa !4
%4 = load i32, ptr %j, align 4, !tbaa !4
%inc = add nsw i32 %4, 1
store i32 %inc, ptr %j, align 4, !tbaa !4
br label %for.cond

for.end: ; preds = %for.cond
%9 = bitcast i32* %j to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %9) #6
%10 = bitcast i32* %val to i8*
call void @llvm.lifetime.end.p0i8(i64 4, i8* %10) #6
call void @llvm.lifetime.end.p0(i64 4, ptr %j) #6
call void @llvm.lifetime.end.p0(i64 4, ptr %val) #6
ret i32 0
}

; Function Attrs: nounwind readnone willreturn
declare i64 @llvm.expect.i64(i64, i64) #4

declare dso_local i32 @sum(i32*, i32) #5
declare dso_local i32 @sum(ptr, i32) #5

declare dso_local i32 @random_sample(i32*, i32) #5
declare dso_local i32 @random_sample(ptr, i32) #5

attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { argmemonly nounwind willreturn }
Expand Down
98 changes: 45 additions & 53 deletions llvm/test/Transforms/PGOProfile/misexpect-switch.ll
Original file line number Diff line number Diff line change
Expand Up @@ -43,40 +43,38 @@ target triple = "x86_64-unknown-linux-gnu"
define dso_local void @init_arry() #0 !dbg !21 {
entry:
%i = alloca i32, align 4
%0 = bitcast i32* %i to i8*, !dbg !26
call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #6, !dbg !26
call void @llvm.dbg.declare(metadata i32* %i, metadata !25, metadata !DIExpression()), !dbg !27
store i32 0, i32* %i, align 4, !dbg !28, !tbaa !30
call void @llvm.lifetime.start.p0(i64 4, ptr %i) #6, !dbg !26
call void @llvm.dbg.declare(metadata ptr %i, metadata !25, metadata !DIExpression()), !dbg !27
store i32 0, ptr %i, align 4, !dbg !28, !tbaa !30
br label %for.cond, !dbg !34

for.cond: ; preds = %for.inc, %entry
%1 = load i32, i32* %i, align 4, !dbg !35, !tbaa !30
%cmp = icmp slt i32 %1, 25, !dbg !37
%0 = load i32, ptr %i, align 4, !dbg !35, !tbaa !30
%cmp = icmp slt i32 %0, 25, !dbg !37
br i1 %cmp, label %for.body, label %for.end, !dbg !38

for.body: ; preds = %for.cond
%call = call i32 @rand() #6, !dbg !39
%rem = srem i32 %call, 10, !dbg !41
%2 = load i32, i32* %i, align 4, !dbg !42, !tbaa !30
%idxprom = sext i32 %2 to i64, !dbg !43
%arrayidx = getelementptr inbounds [25 x i32], [25 x i32]* @arry, i64 0, i64 %idxprom, !dbg !43
store i32 %rem, i32* %arrayidx, align 4, !dbg !44, !tbaa !30
%1 = load i32, ptr %i, align 4, !dbg !42, !tbaa !30
%idxprom = sext i32 %1 to i64, !dbg !43
%arrayidx = getelementptr inbounds [25 x i32], ptr @arry, i64 0, i64 %idxprom, !dbg !43
store i32 %rem, ptr %arrayidx, align 4, !dbg !44, !tbaa !30
br label %for.inc, !dbg !45

for.inc: ; preds = %for.body
%3 = load i32, i32* %i, align 4, !dbg !46, !tbaa !30
%inc = add nsw i32 %3, 1, !dbg !46
store i32 %inc, i32* %i, align 4, !dbg !46, !tbaa !30
%2 = load i32, ptr %i, align 4, !dbg !46, !tbaa !30
%inc = add nsw i32 %2, 1, !dbg !46
store i32 %inc, ptr %i, align 4, !dbg !46, !tbaa !30
br label %for.cond, !dbg !47, !llvm.loop !48

for.end: ; preds = %for.cond
%4 = bitcast i32* %i to i8*, !dbg !50
call void @llvm.lifetime.end.p0i8(i64 4, i8* %4) #6, !dbg !50
call void @llvm.lifetime.end.p0(i64 4, ptr %i) #6, !dbg !50
ret void, !dbg !50
}

; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind readnone speculatable willreturn
declare void @llvm.dbg.declare(metadata, metadata, metadata) #2
Expand All @@ -85,7 +83,7 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) #2
declare dso_local i32 @rand() #3

; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 !dbg !51 {
Expand All @@ -94,32 +92,29 @@ entry:
%val = alloca i32, align 4
%j = alloca i32, align 4
%condition = alloca i32, align 4
store i32 0, i32* %retval, align 4
store i32 0, ptr %retval, align 4
call void @init_arry(), !dbg !62
%0 = bitcast i32* %val to i8*, !dbg !63
call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #6, !dbg !63
call void @llvm.dbg.declare(metadata i32* %val, metadata !55, metadata !DIExpression()), !dbg !64
store i32 0, i32* %val, align 4, !dbg !64, !tbaa !30
%1 = bitcast i32* %j to i8*, !dbg !65
call void @llvm.lifetime.start.p0i8(i64 4, i8* %1) #6, !dbg !65
call void @llvm.dbg.declare(metadata i32* %j, metadata !56, metadata !DIExpression()), !dbg !66
store i32 0, i32* %j, align 4, !dbg !67, !tbaa !30
call void @llvm.lifetime.start.p0(i64 4, ptr %val) #6, !dbg !63
call void @llvm.dbg.declare(metadata ptr %val, metadata !55, metadata !DIExpression()), !dbg !64
store i32 0, ptr %val, align 4, !dbg !64, !tbaa !30
call void @llvm.lifetime.start.p0(i64 4, ptr %j) #6, !dbg !65
call void @llvm.dbg.declare(metadata ptr %j, metadata !56, metadata !DIExpression()), !dbg !66
store i32 0, ptr %j, align 4, !dbg !67, !tbaa !30
br label %for.cond, !dbg !68

for.cond: ; preds = %for.inc, %entry
%2 = load i32, i32* %j, align 4, !dbg !69, !tbaa !30
%cmp = icmp slt i32 %2, 20000, !dbg !70
%0 = load i32, ptr %j, align 4, !dbg !69, !tbaa !30
%cmp = icmp slt i32 %0, 20000, !dbg !70
br i1 %cmp, label %for.body, label %for.end, !dbg !71

for.body: ; preds = %for.cond
%3 = bitcast i32* %condition to i8*, !dbg !72
call void @llvm.lifetime.start.p0i8(i64 4, i8* %3) #6, !dbg !72
call void @llvm.dbg.declare(metadata i32* %condition, metadata !57, metadata !DIExpression()), !dbg !73
call void @llvm.lifetime.start.p0(i64 4, ptr %condition) #6, !dbg !72
call void @llvm.dbg.declare(metadata ptr %condition, metadata !57, metadata !DIExpression()), !dbg !73
%call = call i32 @rand() #6, !dbg !74
%rem = srem i32 %call, 5, !dbg !75
store i32 %rem, i32* %condition, align 4, !dbg !73, !tbaa !30
%4 = load i32, i32* %condition, align 4, !dbg !76, !tbaa !30
%conv = zext i32 %4 to i64, !dbg !76
store i32 %rem, ptr %condition, align 4, !dbg !73, !tbaa !30
%1 = load i32, ptr %condition, align 4, !dbg !76, !tbaa !30
%conv = zext i32 %1 to i64, !dbg !76
%expval = call i64 @llvm.expect.i64(i64 %conv, i64 0), !dbg !77
switch i64 %expval, label %sw.default [
i64 0, label %sw.bb
Expand All @@ -130,50 +125,47 @@ for.body: ; preds = %for.cond
], !dbg !78

sw.bb: ; preds = %for.body
%call1 = call i32 @sum(i32* getelementptr inbounds ([25 x i32], [25 x i32]* @arry, i64 0, i64 0), i32 25), !dbg !79
%5 = load i32, i32* %val, align 4, !dbg !81, !tbaa !30
%add = add nsw i32 %5, %call1, !dbg !81
store i32 %add, i32* %val, align 4, !dbg !81, !tbaa !30
%call1 = call i32 @sum(ptr @arry, i32 25), !dbg !79
%2 = load i32, ptr %val, align 4, !dbg !81, !tbaa !30
%add = add nsw i32 %2, %call1, !dbg !81
store i32 %add, ptr %val, align 4, !dbg !81, !tbaa !30
br label %sw.epilog, !dbg !82

sw.bb2: ; preds = %for.body, %for.body, %for.body
br label %sw.epilog, !dbg !83

sw.bb3: ; preds = %for.body
%call4 = call i32 @random_sample(i32* getelementptr inbounds ([25 x i32], [25 x i32]* @arry, i64 0, i64 0), i32 25), !dbg !84
%6 = load i32, i32* %val, align 4, !dbg !85, !tbaa !30
%add5 = add nsw i32 %6, %call4, !dbg !85
store i32 %add5, i32* %val, align 4, !dbg !85, !tbaa !30
%call4 = call i32 @random_sample(ptr @arry, i32 25), !dbg !84
%3 = load i32, ptr %val, align 4, !dbg !85, !tbaa !30
%add5 = add nsw i32 %3, %call4, !dbg !85
store i32 %add5, ptr %val, align 4, !dbg !85, !tbaa !30
br label %sw.epilog, !dbg !86

sw.default: ; preds = %for.body
unreachable, !dbg !87

sw.epilog: ; preds = %sw.bb3, %sw.bb2, %sw.bb
%7 = bitcast i32* %condition to i8*, !dbg !88
call void @llvm.lifetime.end.p0i8(i64 4, i8* %7) #6, !dbg !88
call void @llvm.lifetime.end.p0(i64 4, ptr %condition) #6, !dbg !88
br label %for.inc, !dbg !89

for.inc: ; preds = %sw.epilog
%8 = load i32, i32* %j, align 4, !dbg !90, !tbaa !30
%inc = add nsw i32 %8, 1, !dbg !90
store i32 %inc, i32* %j, align 4, !dbg !90, !tbaa !30
%4 = load i32, ptr %j, align 4, !dbg !90, !tbaa !30
%inc = add nsw i32 %4, 1, !dbg !90
store i32 %inc, ptr %j, align 4, !dbg !90, !tbaa !30
br label %for.cond, !dbg !91, !llvm.loop !92

for.end: ; preds = %for.cond
%9 = bitcast i32* %j to i8*, !dbg !94
call void @llvm.lifetime.end.p0i8(i64 4, i8* %9) #6, !dbg !94
%10 = bitcast i32* %val to i8*, !dbg !94
call void @llvm.lifetime.end.p0i8(i64 4, i8* %10) #6, !dbg !94
call void @llvm.lifetime.end.p0(i64 4, ptr %j) #6, !dbg !94
call void @llvm.lifetime.end.p0(i64 4, ptr %val) #6, !dbg !94
ret i32 0, !dbg !95
}

; Function Attrs: nounwind readnone willreturn
declare i64 @llvm.expect.i64(i64, i64) #4

declare dso_local i32 @sum(i32*, i32) #5
declare dso_local i32 @sum(ptr, i32) #5

declare dso_local i32 @random_sample(i32*, i32) #5
declare dso_local i32 @random_sample(ptr, i32) #5

attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { argmemonly nounwind willreturn }
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/PGOProfile/multiple_hash_profile.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ target triple = "x86_64-unknown-linux-gnu"

$_Z3fooi = comdat any

@g2 = local_unnamed_addr global i32 (i32)* null, align 8
@g2 = local_unnamed_addr global ptr null, align 8

define i32 @_Z3bari(i32 %i) {
entry:
Expand All @@ -18,7 +18,7 @@ entry:

define void @_Z4m2f1v() {
entry:
store i32 (i32)* @_Z3fooi, i32 (i32)** @g2, align 8
store ptr @_Z3fooi, ptr @g2, align 8
ret void
}

Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/PGOProfile/noprofile.ll
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ target triple = "x86_64-unknown-linux-gnu"
define i32 @test1() {
entry:
; CHECK: call void @llvm.instrprof.increment
%0 = load i32, i32* @i, align 4
%0 = load i32, ptr @i, align 4
%add = add i32 %0, 1
ret i32 %add
}

define i32 @test2() #0 {
entry:
; CHECK-NOT: call void @llvm.instrprof.increment
%0 = load i32, i32* @i, align 4
%0 = load i32, ptr @i, align 4
%sub = sub i32 %0, 1
ret i32 %sub
}
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/Transforms/PGOProfile/not_promote_ret_exit.ll
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ $__llvm_profile_raw_version = comdat any

define dso_local void @foo(i32 %n) {
entry:
call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 29212902728, i32 2, i32 1)
call void @llvm.instrprof.increment(ptr @__profn_foo, i64 29212902728, i32 2, i32 1)
br label %for.cond

for.cond:
%i.0 = phi i32 [ 0, %entry ], [ %inc, %if.end ]
%cmp = icmp slt i32 %i.0, %n
%0 = load i32, i32* @bar, align 4
%0 = load i32, ptr @bar, align 4
%tobool.not = icmp eq i32 %0, 0
%or.cond = and i1 %cmp, %tobool.not
br i1 %or.cond, label %if.end, label %cleanup

if.end:
call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 29212902728, i32 2, i32 0)
call void @llvm.instrprof.increment(ptr @__profn_foo, i64 29212902728, i32 2, i32 0)
call void (...) @bar2()
%inc = add nuw nsw i32 %i.0, 1
br label %for.cond
Expand All @@ -35,4 +35,4 @@ cleanup:

declare dso_local void @bar2(...)

declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
declare void @llvm.instrprof.increment(ptr, i64, i32, i32)
216 changes: 95 additions & 121 deletions llvm/test/Transforms/PGOProfile/ppc-prevent-mma-types.ll
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
; within the IR.

%0 = type <{ double }>
%1 = type <{ [1 x %0]*, i8, i8, i8, i8, i32, i32, i32, [1 x i32], [1 x i32], [1 x i32], [24 x i8] }>
declare i8* @__malloc()
%1 = type <{ ptr, i8, i8, i8, i8, i32, i32, i32, [1 x i32], [1 x i32], [1 x i32], [24 x i8] }>
declare ptr @__malloc()
; CHECK-NOT: <256 x i1>
; CHECK-NOT: <512 x i1>
define dso_local void @test([0 x %0]* %arg, i32* %arg1, i32* %arg2, i32* %arg3, i32* %arg4) {
%i = alloca [0 x %0]*, align 4
store [0 x %0]* %arg, [0 x %0]** %i, align 4
%i7 = alloca i32*, align 4
store i32* %arg1, i32** %i7, align 4
%i9 = alloca i32*, align 4
store i32* %arg2, i32** %i9, align 4
%i10 = alloca i32*, align 4
store i32* %arg3, i32** %i10, align 4
%i11 = alloca i32*, align 4
store i32* %arg4, i32** %i11, align 4
define dso_local void @test(ptr %arg, ptr %arg1, ptr %arg2, ptr %arg3, ptr %arg4) {
%i = alloca ptr, align 4
store ptr %arg, ptr %i, align 4
%i7 = alloca ptr, align 4
store ptr %arg1, ptr %i7, align 4
%i9 = alloca ptr, align 4
store ptr %arg2, ptr %i9, align 4
%i10 = alloca ptr, align 4
store ptr %arg3, ptr %i10, align 4
%i11 = alloca ptr, align 4
store ptr %arg4, ptr %i11, align 4
%i14 = alloca %1, align 4
%i15 = alloca i32, align 4
%i16 = alloca i32, align 4
Expand All @@ -36,169 +36,143 @@ define dso_local void @test([0 x %0]* %arg, i32* %arg1, i32* %arg2, i32* %arg3,
%i22 = alloca i32, align 4
%i23 = alloca i32, align 4
%i25 = alloca double, align 8
%i26 = load i32*, i32** %i9, align 4
%i27 = load i32, i32* %i26, align 4
%i26 = load ptr, ptr %i9, align 4
%i27 = load i32, ptr %i26, align 4
%i28 = select i1 false, i32 0, i32 %i27
store i32 %i28, i32* %i15, align 4
%i29 = load i32*, i32** %i7, align 4
%i30 = load i32, i32* %i29, align 4
store i32 %i28, ptr %i15, align 4
%i29 = load ptr, ptr %i7, align 4
%i30 = load i32, ptr %i29, align 4
%i31 = select i1 false, i32 0, i32 %i30
store i32 %i31, i32* %i16, align 4
%i32 = load i32, i32* %i15, align 4
store i32 %i31, ptr %i16, align 4
%i32 = load i32, ptr %i15, align 4
%i33 = mul i32 8, %i32
store i32 %i33, i32* %i17, align 4
%i34 = load i32, i32* %i17, align 4
%i35 = load i32, i32* %i16, align 4
store i32 %i33, ptr %i17, align 4
%i34 = load i32, ptr %i17, align 4
%i35 = load i32, ptr %i16, align 4
%i36 = mul i32 %i34, %i35
store i32 %i36, i32* %i18, align 4
%i37 = load i32*, i32** %i9, align 4
%i38 = load i32, i32* %i37, align 4
store i32 %i36, ptr %i18, align 4
%i37 = load ptr, ptr %i9, align 4
%i38 = load i32, ptr %i37, align 4
%i39 = select i1 false, i32 0, i32 %i38
store i32 %i39, i32* %i22, align 4
%i40 = load i32*, i32** %i10, align 4
%i41 = load i32, i32* %i40, align 4
store i32 %i39, ptr %i22, align 4
%i40 = load ptr, ptr %i10, align 4
%i41 = load i32, ptr %i40, align 4
%i42 = select i1 false, i32 0, i32 %i41
store i32 %i42, i32* %i23, align 4
%i43 = getelementptr inbounds %1, %1* %i14, i32 0, i32 10
%i44 = bitcast [1 x i32]* %i43 to i8*
%i45 = getelementptr i8, i8* %i44, i32 -12
%i46 = getelementptr inbounds i8, i8* %i45, i32 12
%i47 = bitcast i8* %i46 to i32*
%i48 = load i32, i32* %i23, align 4
store i32 %i42, ptr %i23, align 4
%i43 = getelementptr inbounds %1, ptr %i14, i32 0, i32 10
%i45 = getelementptr i8, ptr %i43, i32 -12
%i46 = getelementptr inbounds i8, ptr %i45, i32 12
%i48 = load i32, ptr %i23, align 4
%i49 = select i1 false, i32 0, i32 %i48
%i50 = load i32, i32* %i22, align 4
%i50 = load i32, ptr %i22, align 4
%i51 = select i1 false, i32 0, i32 %i50
%i52 = mul i32 %i51, 8
%i53 = mul i32 %i49, %i52
store i32 %i53, i32* %i47, align 4
%i54 = getelementptr inbounds %1, %1* %i14, i32 0, i32 10
%i55 = bitcast [1 x i32]* %i54 to i8*
%i56 = getelementptr i8, i8* %i55, i32 -12
%i57 = getelementptr inbounds i8, i8* %i56, i32 36
%i58 = bitcast i8* %i57 to i32*
store i32 8, i32* %i58, align 4
%i60 = getelementptr inbounds %1, %1* %i14, i32 0, i32 0
%i61 = call i8* @__malloc()
%i62 = bitcast [1 x %0]** %i60 to i8**
store i8* %i61, i8** %i62, align 4
store i32 %i53, ptr %i46, align 4
%i54 = getelementptr inbounds %1, ptr %i14, i32 0, i32 10
%i56 = getelementptr i8, ptr %i54, i32 -12
%i57 = getelementptr inbounds i8, ptr %i56, i32 36
store i32 8, ptr %i57, align 4
%i61 = call ptr @__malloc()
store ptr %i61, ptr %i14, align 4
br label %bb63
bb63: ; preds = %bb66, %bb
%i64 = load i32*, i32** %i11, align 4
%i65 = load i32, i32* %i64, align 4
%i64 = load ptr, ptr %i11, align 4
%i65 = load i32, ptr %i64, align 4
br label %bb66
bb66: ; preds = %bb165, %bb63
%i67 = load i32, i32* %i21, align 4
%i67 = load i32, ptr %i21, align 4
%i68 = icmp sle i32 %i67, %i65
br i1 %i68, label %bb69, label %bb63
bb69: ; preds = %bb66
store i32 1, i32* %i20, align 4
store i32 1, ptr %i20, align 4
br label %bb70
bb70: ; preds = %bb163, %bb69
%i71 = load i32, i32* %i20, align 4
%i71 = load i32, ptr %i20, align 4
%i72 = icmp sle i32 %i71, 11
br i1 %i72, label %bb73, label %bb165
bb73: ; preds = %bb70
%i74 = load i32, i32* %i21, align 4
%i74 = load i32, ptr %i21, align 4
%i76 = mul i32 %i74, 8
%i77 = getelementptr inbounds i8, i8* null, i32 %i76
%i78 = bitcast i8* %i77 to double*
%i79 = load double, double* %i78, align 8
%i77 = getelementptr inbounds i8, ptr null, i32 %i76
%i79 = load double, ptr %i77, align 8
%i80 = fcmp fast olt double %i79, 0.000000e+00
%i81 = zext i1 %i80 to i32
%i82 = trunc i32 %i81 to i1
br i1 %i82, label %bb83, label %bb102
bb83: ; preds = %bb73
%i84 = getelementptr inbounds %1, %1* %i14, i32 0, i32 0
%i85 = load [1 x %0]*, [1 x %0]** %i84, align 4
%i86 = bitcast [1 x %0]* %i85 to i8*
%i87 = getelementptr i8, i8* %i86, i32 0
%i88 = load i32, i32* %i20, align 4
%i89 = getelementptr inbounds %1, %1* %i14, i32 0, i32 10
%i90 = getelementptr inbounds [1 x i32], [1 x i32]* %i89, i32 0, i32 0
%i91 = load i32, i32* %i90, align 4
%i85 = load ptr, ptr %i14, align 4
%i88 = load i32, ptr %i20, align 4
%i89 = getelementptr inbounds %1, ptr %i14, i32 0, i32 10
%i91 = load i32, ptr %i89, align 4
%i92 = mul i32 %i88, %i91
%i93 = getelementptr inbounds i8, i8* %i87, i32 %i92
%i94 = getelementptr inbounds i8, i8* %i93, i32 0
%i95 = load i32, i32* %i21, align 4
%i96 = getelementptr inbounds %1, %1* %i14, i32 0, i32 10
%i97 = getelementptr inbounds [1 x i32], [1 x i32]* %i96, i32 0, i32 6
%i98 = load i32, i32* %i97, align 4
%i93 = getelementptr inbounds i8, ptr %i85, i32 %i92
%i95 = load i32, ptr %i21, align 4
%i96 = getelementptr inbounds %1, ptr %i14, i32 0, i32 10
%i97 = getelementptr inbounds [1 x i32], ptr %i96, i32 0, i32 6
%i98 = load i32, ptr %i97, align 4
%i99 = mul i32 %i95, %i98
%i100 = getelementptr inbounds i8, i8* %i94, i32 %i99
%i101 = bitcast i8* %i100 to double*
store double 0.000000e+00, double* %i101, align 8
%i100 = getelementptr inbounds i8, ptr %i93, i32 %i99
store double 0.000000e+00, ptr %i100, align 8
br label %bb163
bb102: ; preds = %bb73
%i103 = getelementptr i8, i8* null, i32 -8
%i104 = getelementptr inbounds i8, i8* %i103, i32 undef
%i105 = bitcast i8* %i104 to double*
%i106 = load double, double* %i105, align 8
%i107 = load [0 x %0]*, [0 x %0]** %i, align 4
%i108 = bitcast [0 x %0]* %i107 to i8*
%i109 = getelementptr i8, i8* %i108, i32 -8
%i110 = getelementptr inbounds i8, i8* %i109, i32 undef
%i111 = bitcast i8* %i110 to double*
%i112 = load double, double* %i111, align 8
%i103 = getelementptr i8, ptr null, i32 -8
%i104 = getelementptr inbounds i8, ptr %i103, i32 undef
%i106 = load double, ptr %i104, align 8
%i107 = load ptr, ptr %i, align 4
%i109 = getelementptr i8, ptr %i107, i32 -8
%i110 = getelementptr inbounds i8, ptr %i109, i32 undef
%i112 = load double, ptr %i110, align 8
%i113 = fmul fast double %i106, %i112
%i114 = fcmp fast ogt double 0.000000e+00, %i113
%i115 = zext i1 %i114 to i32
%i116 = trunc i32 %i115 to i1
br i1 %i116, label %bb117, label %bb136
bb117: ; preds = %bb102
%i118 = getelementptr inbounds %1, %1* %i14, i32 0, i32 0
%i119 = load [1 x %0]*, [1 x %0]** %i118, align 4
%i120 = bitcast [1 x %0]* %i119 to i8*
%i121 = getelementptr i8, i8* %i120, i32 0
%i122 = load i32, i32* %i20, align 4
%i123 = getelementptr inbounds %1, %1* %i14, i32 0, i32 10
%i124 = getelementptr inbounds [1 x i32], [1 x i32]* %i123, i32 0, i32 0
%i125 = load i32, i32* %i124, align 4
%i119 = load ptr, ptr %i14, align 4
%i122 = load i32, ptr %i20, align 4
%i123 = getelementptr inbounds %1, ptr %i14, i32 0, i32 10
%i125 = load i32, ptr %i123, align 4
%i126 = mul i32 %i122, %i125
%i127 = getelementptr inbounds i8, i8* %i121, i32 %i126
%i128 = getelementptr inbounds i8, i8* %i127, i32 0
%i129 = load i32, i32* %i21, align 4
%i130 = getelementptr inbounds %1, %1* %i14, i32 0, i32 10
%i131 = getelementptr inbounds [1 x i32], [1 x i32]* %i130, i32 0, i32 6
%i132 = load i32, i32* %i131, align 4
%i127 = getelementptr inbounds i8, ptr %i119, i32 %i126
%i129 = load i32, ptr %i21, align 4
%i130 = getelementptr inbounds %1, ptr %i14, i32 0, i32 10
%i131 = getelementptr inbounds [1 x i32], ptr %i130, i32 0, i32 6
%i132 = load i32, ptr %i131, align 4
%i133 = mul i32 %i129, %i132
%i134 = getelementptr inbounds i8, i8* %i128, i32 %i133
%i135 = bitcast i8* %i134 to double*
store double 0.000000e+00, double* %i135, align 8
%i134 = getelementptr inbounds i8, ptr %i127, i32 %i133
store double 0.000000e+00, ptr %i134, align 8
br label %bb163
bb136: ; preds = %bb102
%i137 = load double, double* null, align 8
%i138 = load double, double* null, align 8
%i137 = load double, ptr null, align 8
%i138 = load double, ptr null, align 8
%i139 = fmul fast double %i137, %i138
%i140 = fsub fast double 0.000000e+00, %i139
store double %i140, double* %i25, align 8
%i141 = load i32, i32* %i21, align 4
%i143 = getelementptr inbounds [1 x i32], [1 x i32]* null, i32 0, i32 6
%i144 = load i32, i32* %i143, align 4
store double %i140, ptr %i25, align 8
%i141 = load i32, ptr %i21, align 4
%i143 = getelementptr inbounds [1 x i32], ptr null, i32 0, i32 6
%i144 = load i32, ptr %i143, align 4
%i145 = mul i32 %i141, %i144
%i146 = getelementptr inbounds i8, i8* null, i32 %i145
%i147 = bitcast i8* %i146 to double*
%i148 = load i32, i32* %i20, align 4
%i149 = load i32, i32* %i18, align 4
%i146 = getelementptr inbounds i8, ptr null, i32 %i145
%i148 = load i32, ptr %i20, align 4
%i149 = load i32, ptr %i18, align 4
%i151 = mul i32 %i148, %i149
%i152 = getelementptr i8, i8* null, i32 %i151
%i153 = getelementptr i8, i8* %i152, i32 0
%i154 = getelementptr inbounds i8, i8* %i153, i32 0
%i155 = bitcast i8* %i154 to double*
%i156 = load double, double* %i155, align 8
%i157 = load double, double* %i25, align 8
%i152 = getelementptr i8, ptr null, i32 %i151
%i156 = load double, ptr %i152, align 8
%i157 = load double, ptr %i25, align 8
%i158 = fmul fast double %i156, %i157
%i159 = fadd fast double 0.000000e+00, %i158
%i160 = load double, double* %i25, align 8
%i160 = load double, ptr %i25, align 8
%i161 = fadd fast double 0.000000e+00, %i160
%i162 = fdiv fast double %i159, %i161
store double %i162, double* %i147, align 8
store double %i162, ptr %i146, align 8
br label %bb163
bb163: ; preds = %bb136, %bb117, %bb83
%i164 = add nsw i32 %i71, 1
store i32 %i164, i32* %i20, align 4
store i32 %i164, ptr %i20, align 4
br label %bb70
bb165: ; preds = %bb70
%i166 = add nsw i32 %i67, 1
store i32 %i166, i32* %i21, align 4
store i32 %i166, ptr %i21, align 4
br label %bb66
}
64 changes: 32 additions & 32 deletions llvm/test/Transforms/PGOProfile/select_hash_conflict.ll
Original file line number Diff line number Diff line change
Expand Up @@ -24,70 +24,70 @@ target triple = "x86_64-unknown-linux-gnu"

define i32 @foo(i32 %n) {
entry:
%0 = load i8, i8* @c0, align 1
%0 = load i8, ptr @c0, align 1
%tobool = icmp eq i8 %0, 0
%cond = select i1 %tobool, i32 2, i32 1
store i32 %cond, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 0), align 16
%1 = load i8, i8* @c1, align 1
store i32 %cond, ptr @a, align 16
%1 = load i8, ptr @c1, align 1
%tobool2 = icmp eq i8 %1, 0
%cond3 = select i1 %tobool2, i32 2, i32 1
store i32 %cond3, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 1), align 4
%2 = load i8, i8* @c2, align 1
store i32 %cond3, ptr getelementptr inbounds ([16 x i32], ptr @a, i64 0, i64 1), align 4
%2 = load i8, ptr @c2, align 1
%tobool5 = icmp eq i8 %2, 0
%cond6 = select i1 %tobool5, i32 2, i32 1
store i32 %cond6, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 2), align 8
%3 = load i8, i8* @c3, align 1
store i32 %cond6, ptr getelementptr inbounds ([16 x i32], ptr @a, i64 0, i64 2), align 8
%3 = load i8, ptr @c3, align 1
%tobool8 = icmp eq i8 %3, 0
%cond9 = select i1 %tobool8, i32 2, i32 1
store i32 %cond9, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 3), align 4
%4 = load i8, i8* @c4, align 1
store i32 %cond9, ptr getelementptr inbounds ([16 x i32], ptr @a, i64 0, i64 3), align 4
%4 = load i8, ptr @c4, align 1
%tobool11 = icmp eq i8 %4, 0
%cond12 = select i1 %tobool11, i32 2, i32 1
store i32 %cond12, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 4), align 16
%5 = load i8, i8* @c5, align 1
store i32 %cond12, ptr getelementptr inbounds ([16 x i32], ptr @a, i64 0, i64 4), align 16
%5 = load i8, ptr @c5, align 1
%tobool14 = icmp eq i8 %5, 0
%cond15 = select i1 %tobool14, i32 2, i32 1
store i32 %cond15, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 5), align 4
%6 = load i8, i8* @c6, align 1
store i32 %cond15, ptr getelementptr inbounds ([16 x i32], ptr @a, i64 0, i64 5), align 4
%6 = load i8, ptr @c6, align 1
%tobool17 = icmp eq i8 %6, 0
%cond18 = select i1 %tobool17, i32 2, i32 1
store i32 %cond18, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 6), align 8
%7 = load i8, i8* @c7, align 1
store i32 %cond18, ptr getelementptr inbounds ([16 x i32], ptr @a, i64 0, i64 6), align 8
%7 = load i8, ptr @c7, align 1
%tobool20 = icmp eq i8 %7, 0
%cond21 = select i1 %tobool20, i32 2, i32 1
store i32 %cond21, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 7), align 4
%8 = load i8, i8* @c8, align 1
store i32 %cond21, ptr getelementptr inbounds ([16 x i32], ptr @a, i64 0, i64 7), align 4
%8 = load i8, ptr @c8, align 1
%tobool23 = icmp eq i8 %8, 0
%cond24 = select i1 %tobool23, i32 2, i32 1
store i32 %cond24, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 8), align 16
%9 = load i8, i8* @c9, align 1
store i32 %cond24, ptr getelementptr inbounds ([16 x i32], ptr @a, i64 0, i64 8), align 16
%9 = load i8, ptr @c9, align 1
%tobool26 = icmp eq i8 %9, 0
%cond27 = select i1 %tobool26, i32 2, i32 1
store i32 %cond27, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 9), align 4
%10 = load i8, i8* @c10, align 1
store i32 %cond27, ptr getelementptr inbounds ([16 x i32], ptr @a, i64 0, i64 9), align 4
%10 = load i8, ptr @c10, align 1
%tobool29 = icmp eq i8 %10, 0
%cond30 = select i1 %tobool29, i32 2, i32 1
store i32 %cond30, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 10), align 8
%11 = load i8, i8* @c11, align 1
store i32 %cond30, ptr getelementptr inbounds ([16 x i32], ptr @a, i64 0, i64 10), align 8
%11 = load i8, ptr @c11, align 1
%tobool32 = icmp eq i8 %11, 0
%cond33 = select i1 %tobool32, i32 2, i32 1
store i32 %cond33, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 11), align 4
%12 = load i8, i8* @c12, align 1
store i32 %cond33, ptr getelementptr inbounds ([16 x i32], ptr @a, i64 0, i64 11), align 4
%12 = load i8, ptr @c12, align 1
%tobool35 = icmp eq i8 %12, 0
%cond36 = select i1 %tobool35, i32 2, i32 1
store i32 %cond36, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 12), align 16
%13 = load i8, i8* @c13, align 1
store i32 %cond36, ptr getelementptr inbounds ([16 x i32], ptr @a, i64 0, i64 12), align 16
%13 = load i8, ptr @c13, align 1
%tobool38 = icmp eq i8 %13, 0
%cond39 = select i1 %tobool38, i32 2, i32 1
store i32 %cond39, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 13), align 4
%14 = load i8, i8* @c14, align 1
store i32 %cond39, ptr getelementptr inbounds ([16 x i32], ptr @a, i64 0, i64 13), align 4
%14 = load i8, ptr @c14, align 1
%tobool41 = icmp eq i8 %14, 0
%cond42 = select i1 %tobool41, i32 2, i32 1
store i32 %cond42, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 14), align 8
%15 = load i8, i8* @c15, align 1
store i32 %cond42, ptr getelementptr inbounds ([16 x i32], ptr @a, i64 0, i64 14), align 8
%15 = load i8, ptr @c15, align 1
%tobool44 = icmp eq i8 %15, 0
%cond45 = select i1 %tobool44, i32 2, i32 1
store i32 %cond45, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 15), align 4
store i32 %cond45, ptr getelementptr inbounds ([16 x i32], ptr @a, i64 0, i64 15), align 4
ret i32 %n
}
; CHECK-LABEL: define i32 @foo(i32 %n)
Expand Down
46 changes: 23 additions & 23 deletions llvm/test/Transforms/PGOProfile/split-indirectbr-critical-edges.ll
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ entry:
}

; Function Attrs: norecurse nounwind readonly uwtable
define i32 @foo(i8* nocapture readonly %p) #1 {
define i32 @foo(ptr nocapture readonly %p) #1 {
entry:
%targets = alloca [256 x i8*], align 16
%arrayidx1 = getelementptr inbounds [256 x i8*], [256 x i8*]* %targets, i64 0, i64 93
store i8* blockaddress(@foo, %if.end), i8** %arrayidx1, align 8
%targets = alloca [256 x ptr], align 16
%arrayidx1 = getelementptr inbounds [256 x ptr], ptr %targets, i64 0, i64 93
store ptr blockaddress(@foo, %if.end), ptr %arrayidx1, align 8
br label %for.cond2

for.cond2: ; preds = %if.end, %for.cond2, %entry
; CHECK: for.cond2: ; preds = %.split1
%p.addr.0 = phi i8* [ %p, %entry ], [ %incdec.ptr5, %if.end ], [ %incdec.ptr, %for.cond2 ]
%incdec.ptr = getelementptr inbounds i8, i8* %p.addr.0, i64 1
%0 = load i8, i8* %p.addr.0, align 1
%p.addr.0 = phi ptr [ %p, %entry ], [ %incdec.ptr5, %if.end ], [ %incdec.ptr, %for.cond2 ]
%incdec.ptr = getelementptr inbounds i8, ptr %p.addr.0, i64 1
%0 = load i8, ptr %p.addr.0, align 1
%cond = icmp eq i8 %0, 93
br i1 %cond, label %if.end.preheader, label %for.cond2

Expand All @@ -28,14 +28,14 @@ if.end.preheader: ; preds = %for.cond2

if.end: ; preds = %if.end.preheader, %if.end
; CHECK: if.end: ; preds = %.split1
%p.addr.1 = phi i8* [ %incdec.ptr5, %if.end ], [ %incdec.ptr, %if.end.preheader ]
%incdec.ptr5 = getelementptr inbounds i8, i8* %p.addr.1, i64 1
%1 = load i8, i8* %p.addr.1, align 1
%p.addr.1 = phi ptr [ %incdec.ptr5, %if.end ], [ %incdec.ptr, %if.end.preheader ]
%incdec.ptr5 = getelementptr inbounds i8, ptr %p.addr.1, i64 1
%1 = load i8, ptr %p.addr.1, align 1
%idxprom6 = zext i8 %1 to i64
%arrayidx7 = getelementptr inbounds [256 x i8*], [256 x i8*]* %targets, i64 0, i64 %idxprom6
%2 = load i8*, i8** %arrayidx7, align 8
indirectbr i8* %2, [label %for.cond2, label %if.end]
; CHECK: indirectbr i8* %2, [label %for.cond2, label %if.end]
%arrayidx7 = getelementptr inbounds [256 x ptr], ptr %targets, i64 0, i64 %idxprom6
%2 = load ptr, ptr %arrayidx7, align 8
indirectbr ptr %2, [label %for.cond2, label %if.end]
; CHECK: indirectbr ptr %2, [label %for.cond2, label %if.end]
}

;; If an indirectbr critical edge cannot be split, ignore it.
Expand All @@ -47,24 +47,24 @@ if.end: ; preds = %if.end.preheader, %
; CHECK-NOT: call void @llvm.instrprof.increment
; CHECK: indirect2:
; CHECK-NEXT: call void @llvm.instrprof.increment
define i32 @cannot_split(i8* nocapture readonly %p) {
define i32 @cannot_split(ptr nocapture readonly %p) {
entry:
%targets = alloca <2 x i8*>, align 16
store <2 x i8*> <i8* blockaddress(@cannot_split, %indirect), i8* blockaddress(@cannot_split, %end)>, <2 x i8*>* %targets, align 16
%arrayidx2 = getelementptr inbounds i8, i8* %p, i64 1
%0 = load i8, i8* %arrayidx2
%targets = alloca <2 x ptr>, align 16
store <2 x ptr> <ptr blockaddress(@cannot_split, %indirect), ptr blockaddress(@cannot_split, %end)>, ptr %targets, align 16
%arrayidx2 = getelementptr inbounds i8, ptr %p, i64 1
%0 = load i8, ptr %arrayidx2
%idxprom = sext i8 %0 to i64
%arrayidx3 = getelementptr inbounds <2 x i8*>, <2 x i8*>* %targets, i64 0, i64 %idxprom
%1 = load i8*, i8** %arrayidx3, align 8
%arrayidx3 = getelementptr inbounds <2 x ptr>, ptr %targets, i64 0, i64 %idxprom
%1 = load ptr, ptr %arrayidx3, align 8
br label %indirect

indirect: ; preds = %entry, %indirect
indirectbr i8* %1, [label %indirect, label %end, label %indirect2]
indirectbr ptr %1, [label %indirect, label %end, label %indirect2]

indirect2:
; For this test we do not want critical edges split. Adding a 2nd `indirectbr`
; does the trick.
indirectbr i8* %1, [label %indirect, label %end]
indirectbr ptr %1, [label %indirect, label %end]

end: ; preds = %indirect
ret i32 0
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/PGOProfile/thinlto_samplepgo_icp.ll
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@fptr = local_unnamed_addr global void ()* null, align 8
@fptr = local_unnamed_addr global ptr null, align 8

; Function Attrs: norecurse uwtable
define i32 @main() local_unnamed_addr #0 !prof !34 {
entry:
%0 = load void ()*, void ()** @fptr, align 8
%0 = load ptr, ptr @fptr, align 8
; ICALL-PROM: br i1 %{{[0-9]+}}, label %if.true.direct_targ, label %if.false.orig_indirect
tail call void %0(), !prof !40
ret i32 0
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/PGOProfile/thinlto_samplepgo_icp3.ll
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@fptr = local_unnamed_addr global void ()* null, align 8
@fptr = local_unnamed_addr global ptr null, align 8

; Function Attrs: norecurse uwtable
define i32 @main() local_unnamed_addr #0 !prof !34 {
entry:
%0 = load void ()*, void ()** @fptr, align 8
%0 = load ptr, ptr @fptr, align 8
tail call void %0(), !prof !40
ret i32 0
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@fptr = local_unnamed_addr global void ()* null, align 8
@fptr = local_unnamed_addr global ptr null, align 8

define void @_ZL3foov() #1 {
entry:
Expand All @@ -24,7 +24,7 @@ entry:

define i32 @main() local_unnamed_addr #0 !prof !34 {
entry:
%0 = load void ()*, void ()** @fptr, align 8
%0 = load ptr, ptr @fptr, align 8
; OPT-NOT: label %if.false.orig_indirect
; OPT-NODEAD: br i1 %{{[0-9]+}}, label %if.end.icp, label %if.false.orig_indirect
tail call void %0(), !prof !40
Expand Down