62 changes: 31 additions & 31 deletions llvm/test/Transforms/JumpThreading/select.ll
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,16 @@ L4:

; Make sure the blocks in the indirectbr test aren't trivially removable as
; successors by taking their addresses.
@anchor = constant [3 x i8*] [
i8* blockaddress(@test_indirectbr, %L1),
i8* blockaddress(@test_indirectbr, %L2),
i8* blockaddress(@test_indirectbr, %L3)
@anchor = constant [3 x ptr] [
ptr blockaddress(@test_indirectbr, %L1),
ptr blockaddress(@test_indirectbr, %L2),
ptr blockaddress(@test_indirectbr, %L3)
]


; Jump threading of indirectbr with select as address.

define void @test_indirectbr(i1 %cond, i8* %address) nounwind {
define void @test_indirectbr(i1 %cond, ptr %address) nounwind {
; CHECK-LABEL: @test_indirectbr(
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 [[COND:%.*]], label [[L1:%.*]], label [[L3:%.*]]
Expand All @@ -112,8 +112,8 @@ define void @test_indirectbr(i1 %cond, i8* %address) nounwind {
entry:
br i1 %cond, label %L0, label %L3
L0:
%indirect.goto.dest = select i1 %cond, i8* blockaddress(@test_indirectbr, %L1), i8* %address
indirectbr i8* %indirect.goto.dest, [label %L1, label %L2, label %L3]
%indirect.goto.dest = select i1 %cond, ptr blockaddress(@test_indirectbr, %L1), ptr %address
indirectbr ptr %indirect.goto.dest, [label %L1, label %L2, label %L3]

L1:
call void @foo()
Expand All @@ -131,7 +131,7 @@ L3:
; duplication threshold for cases where indirectbr is being threaded
; through.

define void @test_indirectbr_thresh(i1 %cond, i8* %address) nounwind {
define void @test_indirectbr_thresh(i1 %cond, ptr %address) nounwind {
; CHECK-LABEL: @test_indirectbr_thresh(
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 [[COND:%.*]], label [[L1:%.*]], label [[L3:%.*]]
Expand All @@ -148,11 +148,11 @@ define void @test_indirectbr_thresh(i1 %cond, i8* %address) nounwind {
entry:
br i1 %cond, label %L0, label %L3
L0:
%indirect.goto.dest = select i1 %cond, i8* blockaddress(@test_indirectbr_thresh, %L1), i8* %address
%indirect.goto.dest = select i1 %cond, ptr blockaddress(@test_indirectbr_thresh, %L1), ptr %address
call void @quux()
call void @quux()
call void @quux()
indirectbr i8* %indirect.goto.dest, [label %L1, label %L2, label %L3]
indirectbr ptr %indirect.goto.dest, [label %L1, label %L2, label %L3]

L1:
call void @foo()
Expand Down Expand Up @@ -220,45 +220,45 @@ L4:

; Make sure the edge value of %0 from entry to L2 includes 0 and L3 is
; reachable.
define void @test_switch_default(i32* nocapture %status) nounwind {
define void @test_switch_default(ptr nocapture %status) nounwind {
; CHECK-LABEL: @test_switch_default(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[STATUS:%.*]], align 4
; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[STATUS:%.*]], align 4
; CHECK-NEXT: switch i32 [[TMP0]], label [[L2:%.*]] [
; CHECK-NEXT: i32 5061, label [[L2_THREAD:%.*]]
; CHECK-NEXT: i32 0, label [[L2]]
; CHECK-NEXT: ]
; CHECK: L2.thread:
; CHECK-NEXT: store i32 10025, i32* [[STATUS]], align 4
; CHECK-NEXT: store i32 10025, ptr [[STATUS]], align 4
; CHECK-NEXT: br label [[L4:%.*]]
; CHECK: L2:
; CHECK-NEXT: [[TMP1:%.*]] = phi i32 [ [[TMP0]], [[ENTRY:%.*]] ], [ [[TMP0]], [[ENTRY]] ]
; CHECK-NEXT: [[CMP57_I:%.*]] = icmp eq i32 [[TMP1]], 0
; CHECK-NEXT: br i1 [[CMP57_I]], label [[L3:%.*]], label [[L4]]
; CHECK: L3:
; CHECK-NEXT: store i32 10000, i32* [[STATUS]], align 4
; CHECK-NEXT: store i32 10000, ptr [[STATUS]], align 4
; CHECK-NEXT: br label [[L4]]
; CHECK: L4:
; CHECK-NEXT: ret void
;
entry:
%0 = load i32, i32* %status, align 4
%0 = load i32, ptr %status, align 4
switch i32 %0, label %L2 [
i32 5061, label %L1
i32 0, label %L2
]

L1:
store i32 10025, i32* %status, align 4
store i32 10025, ptr %status, align 4
br label %L2

L2:
%1 = load i32, i32* %status, align 4
%1 = load i32, ptr %status, align 4
%cmp57.i = icmp eq i32 %1, 0
br i1 %cmp57.i, label %L3, label %L4

L3:
store i32 10000, i32* %status, align 4
store i32 10000, ptr %status, align 4
br label %L4

L4:
Expand Down Expand Up @@ -522,7 +522,7 @@ cond.false.15.i: ; preds = %cond.false.10.i

; When a select has a constant operand in one branch, and it feeds a phi node
; and the phi node feeds a switch we unfold the select
define void @test_func(i32* nocapture readonly %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %n) local_unnamed_addr #0 {
define void @test_func(ptr nocapture readonly %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %n) local_unnamed_addr #0 {
; CHECK-LABEL: @test_func(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[FOR_COND:%.*]]
Expand All @@ -534,15 +534,15 @@ define void @test_func(i32* nocapture readonly %a, i32* nocapture readonly %b, i
; CHECK-NEXT: ret void
; CHECK: for.body:
; CHECK-NEXT: [[TMP0:%.*]] = zext i32 [[I_0]] to i64
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[A:%.*]], i64 [[TMP0]]
; CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* [[ARRAYIDX]], align 4
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[TMP0]]
; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[ARRAYIDX]], align 4
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32 [[TMP1]], 4
; CHECK-NEXT: br i1 [[CMP1]], label [[LAND_LHS_TRUE:%.*]], label [[IF_END:%.*]]
; CHECK: land.lhs.true:
; CHECK-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds i32, i32* [[B:%.*]], i64 [[TMP0]]
; CHECK-NEXT: [[TMP2:%.*]] = load i32, i32* [[ARRAYIDX3]], align 4
; CHECK-NEXT: [[ARRAYIDX5:%.*]] = getelementptr inbounds i32, i32* [[C:%.*]], i64 [[TMP0]]
; CHECK-NEXT: [[TMP3:%.*]] = load i32, i32* [[ARRAYIDX5]], align 4
; CHECK-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds i32, ptr [[B:%.*]], i64 [[TMP0]]
; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[ARRAYIDX3]], align 4
; CHECK-NEXT: [[ARRAYIDX5:%.*]] = getelementptr inbounds i32, ptr [[C:%.*]], i64 [[TMP0]]
; CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[ARRAYIDX5]], align 4
; CHECK-NEXT: [[CMP6:%.*]] = icmp eq i32 [[TMP2]], [[TMP3]]
; CHECK-NEXT: br i1 [[CMP6]], label [[SW_BB:%.*]], label [[SW_BB7:%.*]]
; CHECK: if.end:
Expand Down Expand Up @@ -583,16 +583,16 @@ for.cond.cleanup: ; preds = %for.cond

for.body: ; preds = %for.cond
%0 = zext i32 %i.0 to i64
%arrayidx = getelementptr inbounds i32, i32* %a, i64 %0
%1 = load i32, i32* %arrayidx, align 4
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %0
%1 = load i32, ptr %arrayidx, align 4
%cmp1 = icmp eq i32 %1, 4
br i1 %cmp1, label %land.lhs.true, label %if.end

land.lhs.true: ; preds = %for.body
%arrayidx3 = getelementptr inbounds i32, i32* %b, i64 %0
%2 = load i32, i32* %arrayidx3, align 4
%arrayidx5 = getelementptr inbounds i32, i32* %c, i64 %0
%3 = load i32, i32* %arrayidx5, align 4
%arrayidx3 = getelementptr inbounds i32, ptr %b, i64 %0
%2 = load i32, ptr %arrayidx3, align 4
%arrayidx5 = getelementptr inbounds i32, ptr %c, i64 %0
%3 = load i32, ptr %arrayidx5, align 4
%cmp6 = icmp eq i32 %2, %3
%spec.select = select i1 %cmp6, i32 2, i32 4
br label %if.end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%"type1" = type { i8 }
%"type2" = type opaque

define dso_local i16* @func2(%"type1"* %this, %"type2"*) {
define dso_local ptr @func2(ptr %this, ptr) {
entry:
br label %while.cond

Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/JumpThreading/static-profile.ll
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@

declare void @bar()

define void @foo(i32 *%p, i32 %n) !prof !0 {
define void @foo(ptr %p, i32 %n) !prof !0 {
entry:
%enter_loop = icmp eq i32 %n, 0
br i1 %enter_loop, label %exit, label %check_1, !prof !1
; CHECK: br i1 %enter_loop, label %exit, label %check_1, !prof !1

check_1:
%v = load i32, i32* %p
%v = load i32, ptr %p
%cond1 = icmp eq i32 %v, 1
br i1 %cond1, label %eq_1, label %check_2
; No metadata:
Expand Down
24 changes: 12 additions & 12 deletions llvm/test/Transforms/JumpThreading/thread-cmp.ll
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
; RUN: opt -S -jump-threading %s | FileCheck %s
; When simplify a branch based on LVI predicates, we should replace the
; When simplify a branch based on LVI predicates, we should replace the
; comparison itself with a constant (when possible) in case it's otherwise used.

define i32 @test(i32* %p) {
define i32 @test(ptr %p) {
; CHECK-LABEL: @test
; CHECK: icmp eq
; CHECK-NEXT: br i1 %cmp, label %exit2, label %exit1
; CHECK-NOT: icmp ne
entry:
%cmp = icmp eq i32* %p, null
%cmp = icmp eq ptr %p, null
br i1 %cmp, label %is_null, label %not_null
is_null:
%cmp2 = icmp ne i32* %p, null
%cmp2 = icmp ne ptr %p, null
br i1 %cmp2, label %exit1, label %exit2
not_null:
%cmp3 = icmp ne i32* %p, null
%cmp3 = icmp ne ptr %p, null
br i1 %cmp3, label %exit1, label %exit2
exit1:
ret i32 0
Expand All @@ -24,18 +24,18 @@ exit2:

declare void @use(i1)

; It would not be legal to replace %cmp2 (well, in this case it actually is,
; It would not be legal to replace %cmp2 (well, in this case it actually is,
; but that's a CSE problem, not a LVI/jump threading problem)
define i32 @test_negative(i32* %p) {
define i32 @test_negative(ptr %p) {
; CHECK-LABEL: @test
; CHECK: icmp ne
; CHECK: icmp eq
; CHECK-NEXT: br i1 %cmp, label %exit2, label %exit1
; CHECK-NOT: icmp ne
entry:
%cmp2 = icmp ne i32* %p, null
%cmp2 = icmp ne ptr %p, null
call void @use(i1 %cmp2)
%cmp = icmp eq i32* %p, null
%cmp = icmp eq ptr %p, null
br i1 %cmp, label %is_null, label %not_null
is_null:
br i1 %cmp2, label %exit1, label %exit2
Expand All @@ -48,15 +48,15 @@ exit2:
}

; In this case, we can remove cmp2 because it's otherwise unused
define i32 @test2(i32* %p) {
define i32 @test2(ptr %p) {
; CHECK-LABEL: @test
; CHECK-LABEL: entry:
; CHECK-NEXT: icmp eq
; CHECK-NEXT: br i1 %cmp, label %exit2, label %exit1
; CHECK-NOT: icmp ne
entry:
%cmp2 = icmp ne i32* %p, null
%cmp = icmp eq i32* %p, null
%cmp2 = icmp ne ptr %p, null
%cmp = icmp eq ptr %p, null
br i1 %cmp, label %is_null, label %not_null
is_null:
br i1 %cmp2, label %exit1, label %exit2
Expand Down
197 changes: 97 additions & 100 deletions llvm/test/Transforms/JumpThreading/thread-loads.ll

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion llvm/test/Transforms/JumpThreading/thread-two-bbs-msvc.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ target triple = "x86_64-pc-windows-msvc19.16.27026"
; Verify that we do *not* thread any edge. On Windows, we used to
; improperly duplicate EH pads like bb_cleanup below, resulting in an
; assertion failure later down the pass pipeline.
define void @foo([2 x i8]* %0) personality i8* bitcast (i32 ()* @baz to i8*) {
define void @foo(ptr %0) personality ptr @baz {
; CHECK-LABEL: @foo
; CHECK-NOT: bb_{{[^ ]*}}.thread:
entry:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ define void @foo(i32 %cond1, i32 %cond2) {
; CHECK-NEXT: call void @f3()
; CHECK-NEXT: br label [[EXIT]]
; CHECK: bb.f4:
; CHECK-NEXT: [[PTR5:%.*]] = phi i32* [ null, [[BB_COND2]] ]
; CHECK-NEXT: [[PTR5:%.*]] = phi ptr [ null, [[BB_COND2]] ]
; CHECK-NEXT: call void @f4()
; CHECK-NEXT: br label [[EXIT]]
; CHECK: exit:
Expand All @@ -45,7 +45,7 @@ bb.f1:
br label %bb.cond2

bb.cond2:
%ptr = phi i32* [ null, %bb.f1 ], [ @a, %entry ]
%ptr = phi ptr [ null, %bb.f1 ], [ @a, %entry ]
%cond2.fr = freeze i32 %cond2
%x = add i32 %cond2.fr, 1
%tobool1 = icmp eq i32 %x, 0
Expand All @@ -56,7 +56,7 @@ bb.f2:
br label %exit

bb.file:
%cmp = icmp eq i32* %ptr, null
%cmp = icmp eq ptr %ptr, null
br i1 %cmp, label %bb.f4, label %bb.f3

bb.f3:
Expand Down
56 changes: 28 additions & 28 deletions llvm/test/Transforms/JumpThreading/thread-two-bbs.ll
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ define void @foo(i32 %cond1, i32 %cond2) {
; CHECK-NEXT: call void @f3()
; CHECK-NEXT: br label [[EXIT]]
; CHECK: bb.f4:
; CHECK-NEXT: [[PTR3:%.*]] = phi i32* [ null, [[BB_COND2]] ]
; CHECK-NEXT: [[PTR3:%.*]] = phi ptr [ null, [[BB_COND2]] ]
; CHECK-NEXT: call void @f4()
; CHECK-NEXT: br label [[EXIT]]
; CHECK: exit:
Expand All @@ -43,7 +43,7 @@ bb.f1:
br label %bb.cond2

bb.cond2:
%ptr = phi i32* [ null, %bb.f1 ], [ @a, %entry ]
%ptr = phi ptr [ null, %bb.f1 ], [ @a, %entry ]
%tobool1 = icmp eq i32 %cond2, 0
br i1 %tobool1, label %bb.file, label %bb.f2

Expand All @@ -52,7 +52,7 @@ bb.f2:
br label %exit

bb.file:
%cmp = icmp eq i32* %ptr, null
%cmp = icmp eq ptr %ptr, null
br i1 %cmp, label %bb.f4, label %bb.f3

bb.f3:
Expand Down Expand Up @@ -133,26 +133,26 @@ exit:
; Verify that we do *not* thread any edge. We used to evaluate
; constant expressions like:
;
; icmp ugt i8* null, inttoptr (i64 4 to i8*)
; icmp ugt ptr null, inttoptr (i64 4 to ptr)
;
; as "true", causing jump threading to a wrong destination.

define void @icmp_ult_null_constexpr(i8* %arg1, i8* %arg2) {
define void @icmp_ult_null_constexpr(ptr %arg1, ptr %arg2) {
; CHECK-LABEL: @icmp_ult_null_constexpr(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8* [[ARG1:%.*]], null
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq ptr [[ARG1:%.*]], null
; CHECK-NEXT: br i1 [[CMP1]], label [[BB_BAR1:%.*]], label [[BB_END:%.*]]
; CHECK: bb_bar1:
; CHECK-NEXT: call void @bar(i32 1)
; CHECK-NEXT: br label [[BB_END]]
; CHECK: bb_end:
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8* [[ARG2:%.*]], null
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne ptr [[ARG2:%.*]], null
; CHECK-NEXT: br i1 [[CMP2]], label [[BB_CONT:%.*]], label [[BB_BAR2:%.*]]
; CHECK: bb_bar2:
; CHECK-NEXT: call void @bar(i32 2)
; CHECK-NEXT: br label [[BB_EXIT:%.*]]
; CHECK: bb_cont:
; CHECK-NEXT: [[CMP3:%.*]] = icmp ult i8* [[ARG1]], inttoptr (i64 4 to i8*)
; CHECK-NEXT: [[CMP3:%.*]] = icmp ult ptr [[ARG1]], inttoptr (i64 4 to ptr)
; CHECK-NEXT: br i1 [[CMP3]], label [[BB_EXIT]], label [[BB_BAR3:%.*]]
; CHECK: bb_bar3:
; CHECK-NEXT: call void @bar(i32 3)
Expand All @@ -161,23 +161,23 @@ define void @icmp_ult_null_constexpr(i8* %arg1, i8* %arg2) {
; CHECK-NEXT: ret void
;
entry:
%cmp1 = icmp eq i8* %arg1, null
%cmp1 = icmp eq ptr %arg1, null
br i1 %cmp1, label %bb_bar1, label %bb_end

bb_bar1:
call void @bar(i32 1)
br label %bb_end

bb_end:
%cmp2 = icmp ne i8* %arg2, null
%cmp2 = icmp ne ptr %arg2, null
br i1 %cmp2, label %bb_cont, label %bb_bar2

bb_bar2:
call void @bar(i32 2)
br label %bb_exit

bb_cont:
%cmp3 = icmp ult i8* %arg1, inttoptr (i64 4 to i8*)
%cmp3 = icmp ult ptr %arg1, inttoptr (i64 4 to ptr)
br i1 %cmp3, label %bb_exit, label %bb_bar3

bb_bar3:
Expand All @@ -191,23 +191,23 @@ bb_exit:
; This is a special-case of the above pattern:
; Null is guaranteed to be unsigned <= all values.

define void @icmp_ule_null_constexpr(i8* %arg1, i8* %arg2) {
define void @icmp_ule_null_constexpr(ptr %arg1, ptr %arg2) {
; CHECK-LABEL: @icmp_ule_null_constexpr(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8* [[ARG1:%.*]], null
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq ptr [[ARG1:%.*]], null
; CHECK-NEXT: br i1 [[CMP1]], label [[BB_END_THREAD:%.*]], label [[BB_END:%.*]]
; CHECK: bb_end:
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8* [[ARG2:%.*]], null
; CHECK-NEXT: [[CMP2:%.*]] = icmp ne ptr [[ARG2:%.*]], null
; CHECK-NEXT: br i1 [[CMP2]], label [[BB_CONT:%.*]], label [[BB_BAR2:%.*]]
; CHECK: bb_end.thread:
; CHECK-NEXT: call void @bar(i32 1)
; CHECK-NEXT: [[CMP21:%.*]] = icmp ne i8* [[ARG2]], null
; CHECK-NEXT: [[CMP21:%.*]] = icmp ne ptr [[ARG2]], null
; CHECK-NEXT: br i1 [[CMP21]], label [[BB_EXIT:%.*]], label [[BB_BAR2]]
; CHECK: bb_bar2:
; CHECK-NEXT: call void @bar(i32 2)
; CHECK-NEXT: br label [[BB_EXIT]]
; CHECK: bb_cont:
; CHECK-NEXT: [[CMP3:%.*]] = icmp ule i8* [[ARG1]], inttoptr (i64 4 to i8*)
; CHECK-NEXT: [[CMP3:%.*]] = icmp ule ptr [[ARG1]], inttoptr (i64 4 to ptr)
; CHECK-NEXT: br i1 [[CMP3]], label [[BB_EXIT]], label [[BB_BAR3:%.*]]
; CHECK: bb_bar3:
; CHECK-NEXT: call void @bar(i32 3)
Expand All @@ -216,23 +216,23 @@ define void @icmp_ule_null_constexpr(i8* %arg1, i8* %arg2) {
; CHECK-NEXT: ret void
;
entry:
%cmp1 = icmp eq i8* %arg1, null
%cmp1 = icmp eq ptr %arg1, null
br i1 %cmp1, label %bb_bar1, label %bb_end

bb_bar1:
call void @bar(i32 1)
br label %bb_end

bb_end:
%cmp2 = icmp ne i8* %arg2, null
%cmp2 = icmp ne ptr %arg2, null
br i1 %cmp2, label %bb_cont, label %bb_bar2

bb_bar2:
call void @bar(i32 2)
br label %bb_exit

bb_cont:
%cmp3 = icmp ule i8* %arg1, inttoptr (i64 4 to i8*)
%cmp3 = icmp ule ptr %arg1, inttoptr (i64 4 to ptr)
br i1 %cmp3, label %bb_exit, label %bb_bar3

bb_bar3:
Expand All @@ -249,38 +249,38 @@ declare void @bar(i32)
;; Test that we skip unconditional PredBB when threading jumps through two
;; successive basic blocks.

define i32 @foo4(i32* %0) {
define i32 @foo4(ptr %0) {
; CHECK-LABEL: @foo4(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[SIZE:%.*]] = call i64 @get_size(i32* [[TMP0:%.*]])
; CHECK-NEXT: [[SIZE:%.*]] = call i64 @get_size(ptr [[TMP0:%.*]])
; CHECK-NEXT: [[GOOD:%.*]] = icmp ugt i64 [[SIZE]], 3
; CHECK-NEXT: br i1 [[GOOD]], label [[PRED_BB:%.*]], label [[PRED_PRED_BB:%.*]]
; CHECK: pred.pred.bb:
; CHECK-NEXT: call void @effect()
; CHECK-NEXT: br label [[PRED_BB]]
; CHECK: pred.bb:
; CHECK-NEXT: [[V:%.*]] = load i32, i32* [[TMP0]], align 4
; CHECK-NEXT: [[V:%.*]] = load i32, ptr [[TMP0]], align 4
; CHECK-NEXT: br label [[BB:%.*]]
; CHECK: bb:
; CHECK-NEXT: call void @effect1(i8* blockaddress(@foo4, [[BB]]))
; CHECK-NEXT: call void @effect1(ptr blockaddress(@foo4, [[BB]]))
; CHECK-NEXT: br i1 [[GOOD]], label [[EXIT:%.*]], label [[EXIT]]
; CHECK: exit:
; CHECK-NEXT: ret i32 [[V]]
;
entry:
%size = call i64 @get_size(i32* %0)
%size = call i64 @get_size(ptr %0)
%good = icmp ugt i64 %size, 3
br i1 %good, label %pred.bb, label %pred.pred.bb

pred.pred.bb: ; preds = %entry
call void @effect()
br label %pred.bb
pred.bb: ; preds = %pred.pred.bb, %entry
%v = load i32, i32* %0
%v = load i32, ptr %0
br label %bb

bb: ; preds = %pred.bb
call void @effect1(i8* blockaddress(@foo4, %bb))
call void @effect1(ptr blockaddress(@foo4, %bb))
br i1 %good, label %cont2, label %cont1

cont1: ; preds = %bb
Expand All @@ -291,6 +291,6 @@ exit: ; preds = %cont1, %cont2
ret i32 %v
}

declare i64 @get_size(i32*)
declare i64 @get_size(ptr)
declare void @effect()
declare void @effect1(i8*)
declare void @effect1(ptr)
22 changes: 11 additions & 11 deletions llvm/test/Transforms/JumpThreading/threading_prof1.ll
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,24 @@ bb:
br i1 %tmp1, label %bb5_1, label %bb2
; CHECK: br i1 %tmp1,{{.*}} !prof ![[PROF1:[0-9]+]]

bb5_1:
bb5_1:
br label %bb5;

bb2:
bb2:
%tmp3 = call i32 @b()
%tmp4 = icmp ne i32 %tmp3, 1
br label %bb5
; CHECK: br i1 %tmp4, {{.*}} !prof ![[PROF2:[0-9]+]]

bb5:
bb5:
%tmp6 = phi i1 [ false, %bb5_1 ], [ %tmp4, %bb2 ]
br i1 %tmp6, label %bb8, label %bb7, !prof !0

bb7:
bb7:
call void @bar()
br label %bb8

bb8:
bb8:
ret void
}

Expand All @@ -64,27 +64,27 @@ bb:
br i1 %tmp1, label %bb5_1, label %bb2
; CHECK: br i1 %tmp1,{{.*}} !prof ![[PROF1:[0-9]+]]

bb5_1:
bb5_1:
br label %bb5_2;

bb5_2:
bb5_2:
br label %bb5;

bb2:
bb2:
%tmp3 = call i32 @b()
%tmp4 = icmp ne i32 %tmp3, 1
br label %bb5
; CHECK: br i1 %tmp4, {{.*}} !prof ![[PROF2:[0-9]+]]

bb5:
bb5:
%tmp6 = phi i1 [ false, %bb5_2 ], [ %tmp4, %bb2 ]
br i1 %tmp6, label %bb8, label %bb7, !prof !0

bb7:
bb7:
call void @bar()
br label %bb8

bb8:
bb8:
ret void
}

Expand Down
10 changes: 5 additions & 5 deletions llvm/test/Transforms/JumpThreading/threading_prof2.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ bb:
br i1 %tmp1, label %bb5, label %bb2
; CHECK: br i1 %tmp1,{{.*}} !prof ![[PROF1:[0-9]+]]

bb2:
bb2:
%tmp3 = call i32 @b()
%tmp4 = icmp ne i32 %tmp3, 1
br label %bb5
; CHECK: br i1 %tmp4, {{.*}} !prof ![[PROF2:[0-9]+]]

bb5:
bb5:
%tmp6 = phi i1 [ false, %bb ], [ %tmp4, %bb2 ]
br i1 %tmp6, label %bb8, label %bb7, !prof !0

bb7:
bb7:
call void @bar()
br label %bb9

bb8:
bb8:
call void @foo()
br label %bb9

bb9:
bb9:
ret void
}

Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/JumpThreading/unreachable-loops.ll
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ define void @PR48362() {
; CHECK-NEXT: cleanup.cont1500:
; CHECK-NEXT: unreachable
; CHECK: if.end1733:
; CHECK-NEXT: [[I82:%.*]] = load i32, i32* undef, align 1
; CHECK-NEXT: [[I82:%.*]] = load i32, ptr undef, align 1
; CHECK-NEXT: [[TOBOOL1731_NOT:%.*]] = icmp eq i32 [[I82]], 0
; CHECK-NEXT: br label [[IF_END1733:%.*]]
;
Expand All @@ -120,7 +120,7 @@ lbl_555.loopexit: ; preds = %cleanup1491
for.body1509: ; preds = %for.inc2340, %lbl_555.loopexit
%l_580.sroa.0.0 = phi <4 x i32> [ <i32 1684658741, i32 1684658741, i32 1684658741, i32 1684658741>, %lbl_555.loopexit ], [ %l_580.sroa.0.2, %for.inc2340 ]
%p_55.addr.10 = phi i16 [ 0, %lbl_555.loopexit ], [ %p_55.addr.11, %for.inc2340 ]
%i82 = load i32, i32* undef, align 1
%i82 = load i32, ptr undef, align 1
%tobool1731.not = icmp eq i32 %i82, 0
br i1 %tobool1731.not, label %if.end1733, label %if.then1732

Expand Down