Skip to content

Commit

Permalink
Remove br undef in Analysis directory
Browse files Browse the repository at this point in the history
  • Loading branch information
leewei05 committed Nov 6, 2024
1 parent 5ee4e9b commit 30c80a2
Show file tree
Hide file tree
Showing 67 changed files with 1,045 additions and 600 deletions.
8 changes: 4 additions & 4 deletions llvm/test/Analysis/BasicAA/phi-values-usage.ll
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
; This function is one where if we didn't free basicaa after memcpyopt then the
; usage of basicaa in instcombine would cause a segfault due to stale phi-values
; results being used.
define void @fn(ptr %this, ptr %ptr) personality ptr @__gxx_personality_v0 {
define void @fn(ptr %this, ptr %ptr, i1 %arg) personality ptr @__gxx_personality_v0 {
entry:
%arr = alloca [4 x i8], align 8
br i1 undef, label %then, label %if
br i1 %arg, label %then, label %if

if:
br label %then
Expand All @@ -50,15 +50,15 @@ lpad:
; When running instcombine after memdep, the basicaa used by instcombine uses
; the phivalues that memdep used. This would then cause a segfault due to
; instcombine deleting a phi whose values had been cached.
define void @fn2() {
define void @fn2(i1 %arg) {
entry:
%a = alloca i8, align 1
%0 = load ptr, ptr @c, align 1
br label %for.cond

for.cond: ; preds = %for.body, %entry
%d.0 = phi ptr [ %0, %entry ], [ null, %for.body ]
br i1 undef, label %for.body, label %for.cond.cleanup
br i1 %arg, label %for.body, label %for.cond.cleanup

for.body: ; preds = %for.cond
store volatile i8 undef, ptr %a, align 1
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Analysis/BasicAA/underlying-value.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"

define void @func_20() nounwind {
define void @func_20(i1 %arg) nounwind {
entry:
br label %for.cond

for.cond: ; preds = %for.cond2, %entry
br i1 undef, label %for.cond2, label %for.end22
br i1 %arg, label %for.cond2, label %for.end22

for.cond2: ; preds = %for.body5, %for.cond
br i1 false, label %for.body5, label %for.cond
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define void @fn1(ptr %f) {
define void @fn1(ptr %f, i1 %arg) {
entry:
%tobool7 = icmp eq i32 undef, 0
br i1 undef, label %if.end.12, label %for.body.5
br i1 %arg, label %if.end.12, label %for.body.5

for.inc:
store i32 undef, ptr %f, align 4
Expand All @@ -19,7 +19,7 @@ for.inc.9: ; preds = %for.body.5
br i1 %tobool7, label %for.inc.9.1, label %for.inc

if.end.12: ; preds = %if.end.12, %for.body
br i1 undef, label %for.end.17, label %for.inc
br i1 %arg, label %for.end.17, label %for.inc

for.end.17: ; preds = %entry
ret void
Expand Down
12 changes: 6 additions & 6 deletions llvm/test/Analysis/BranchProbabilityInfo/deopt-invoke.ll
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ declare void @cold() cold

; Even though the likeliness of 'invoke' to throw an exception is assessed as low
; all other paths are even less likely. Check that hot paths leads to excepion handler.
define void @test1(i32 %0) personality ptr @"personality_function" !prof !1 {
define void @test1(i32 %0, i1 %arg) personality ptr @"personality_function" !prof !1 {
;CHECK: edge %entry -> %unreached probability is 0x00000001 / 0x80000000 = 0.00%
;CHECK: edge %entry -> %invoke probability is 0x7fffffff / 0x80000000 = 100.00% [HOT edge]
;CHECK: edge %invoke -> %invoke.cont.unreached probability is 0x00000000 / 0x80000000 = 0.00%
;CHECK: edge %invoke -> %land.pad probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
;CHECK: edge %land.pad -> %exit probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]

entry:
br i1 undef, label %unreached, label %invoke, !prof !2
br i1 %arg, label %unreached, label %invoke, !prof !2
invoke:
invoke void @foo(i32 %0)
to label %invoke.cont.unreached unwind label %land.pad
Expand All @@ -38,15 +38,15 @@ exit:
ret void
}

define void @test2(i32 %0) personality ptr @"personality_function" {
define void @test2(i32 %0, i1 %arg) personality ptr @"personality_function" {
;CHECK: edge %entry -> %unreached probability is 0x00000000 / 0x80000000 = 0.00%
;CHECK: edge %entry -> %invoke probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
;CHECK: edge %invoke -> %invoke.cont.cold probability is 0x7fff8000 / 0x80000000 = 100.00% [HOT edge]
;CHECK: edge %invoke -> %land.pad probability is 0x00008000 / 0x80000000 = 0.00%
;CHECK: edge %land.pad -> %exit probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]

entry:
br i1 undef, label %unreached, label %invoke
br i1 %arg, label %unreached, label %invoke
invoke:
invoke void @foo(i32 %0)
to label %invoke.cont.cold unwind label %land.pad
Expand All @@ -68,14 +68,14 @@ exit:
ret void
}

define void @test3(i32 %0) personality ptr @"personality_function" {
define void @test3(i32 %0, i1 %arg) personality ptr @"personality_function" {
;CHECK: edge %entry -> %unreached probability is 0x00000000 / 0x80000000 = 0.00%
;CHECK: edge %entry -> %invoke probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
;CHECK: edge %invoke -> %invoke.cont.cold probability is 0x7fff8000 / 0x80000000 = 100.00% [HOT edge]
;CHECK: edge %invoke -> %land.pad probability is 0x00008000 / 0x80000000 = 0.00%
;CHECK: edge %land.pad -> %exit probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
entry:
br i1 undef, label %unreached, label %invoke
br i1 %arg, label %unreached, label %invoke
invoke:
invoke void @foo(i32 %0)
to label %invoke.cont.cold unwind label %land.pad
Expand Down
44 changes: 22 additions & 22 deletions llvm/test/Analysis/BranchProbabilityInfo/loop.ll
Original file line number Diff line number Diff line change
Expand Up @@ -523,20 +523,20 @@ declare void @cold() cold

; If loop has single exit and it leads to 'cold' block then edge leading to loop enter
; should be considered 'cold' as well.
define void @test13() {
define void @test13(i1 %arg) {
; CHECK: edge %entry -> %loop probability is 0x078780e3 / 0x80000000 = 5.88%
; CHECK: edge %entry -> %exit probability is 0x78787f1d / 0x80000000 = 94.12% [HOT edge]
; CHECK: edge %loop -> %loop probability is 0x7fbe1203 / 0x80000000 = 99.80% [HOT edge]
; CHECK: edge %loop -> %cold probability is 0x0041edfd / 0x80000000 = 0.20%
; CHECK: edge %cold -> %exit probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]

entry:
br i1 undef, label %loop, label %exit
br i1 %arg, label %loop, label %exit

loop:
%i.0 = phi i32 [ 0, %entry ], [ %inc, %loop ]
%inc = add nsw i32 %i.0, 1
br i1 undef, label %loop, label %cold
br i1 %arg, label %loop, label %cold

cold:
call void @cold()
Expand All @@ -547,7 +547,7 @@ exit:
}

; This is the same case as test13 but with additional loop 'preheader' block.
define void @test14() {
define void @test14(i1 %arg) {
; CHECK: edge %entry -> %preheader probability is 0x078780e3 / 0x80000000 = 5.88%
; CHECK: edge %entry -> %exit probability is 0x78787f1d / 0x80000000 = 94.12% [HOT edge]
; CHECK: edge %preheader -> %loop probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
Expand All @@ -556,15 +556,15 @@ define void @test14() {
; CHECK: edge %cold -> %exit probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]

entry:
br i1 undef, label %preheader, label %exit
br i1 %arg, label %preheader, label %exit

preheader:
br label %loop

loop:
%i.0 = phi i32 [ 0, %preheader ], [ %inc, %loop ]
%inc = add nsw i32 %i.0, 1
br i1 undef, label %loop, label %cold
br i1 %arg, label %loop, label %cold

cold:
call void @cold()
Expand All @@ -576,7 +576,7 @@ exit:

; If loop has multiple low probability exits then edge leading to loop enter
; should be considered low probable as well.
define void @test15() {
define void @test15(i1 %arg) {
; CHECK: edge %entry -> %loop probability is 0x078780e3 / 0x80000000 = 5.88%
; CHECK: edge %entry -> %exit probability is 0x78787f1d / 0x80000000 = 94.12% [HOT edge]
; CHECK: edge %loop -> %cont probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
Expand All @@ -586,15 +586,15 @@ define void @test15() {
; CHECK: edge %cold -> %exit probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]

entry:
br i1 undef, label %loop, label %exit
br i1 %arg, label %loop, label %exit

loop:
%i.0 = phi i32 [ 0, %entry ], [ %inc, %cont ]
%inc = add nsw i32 %i.0, 1
br i1 undef, label %cont, label %unreached
br i1 %arg, label %cont, label %unreached

cont:
br i1 undef, label %loop, label %cold
br i1 %arg, label %loop, label %cold

unreached:
unreachable
Expand All @@ -609,7 +609,7 @@ exit:
}

; This is the same case as test15 but with additional loop 'preheader' block.
define void @test16() {
define void @test16(i1 %arg) {
; CHECK: edge %entry -> %preheader probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
; CHECK: edge %preheader -> %loop probability is 0x078780e3 / 0x80000000 = 5.88%
; CHECK: edge %preheader -> %exit probability is 0x78787f1d / 0x80000000 = 94.12% [HOT edge]
Expand All @@ -623,15 +623,15 @@ entry:
br label %preheader

preheader:
br i1 undef, label %loop, label %exit
br i1 %arg, label %loop, label %exit

loop:
%i.0 = phi i32 [ 0, %preheader ], [ %inc, %cont ]
%inc = add nsw i32 %i.0, 1
br i1 undef, label %cont, label %unreached
br i1 %arg, label %cont, label %unreached

cont:
br i1 undef, label %loop, label %cold
br i1 %arg, label %loop, label %cold

unreached:
unreachable
Expand All @@ -649,7 +649,7 @@ declare void @abort() noreturn

; Check that 'preheader' has 50/50 probability since there is one 'normal' exit.
; Check that exit to 'cold' and 'noreturn' has lower probability than 'normal' exit.
define void @test17() {
define void @test17(i1 %arg) {
; CHECK: edge %entry -> %preheader probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
; CHECK: edge %preheader -> %loop probability is 0x40000000 / 0x80000000 = 50.00%
; CHECK: edge %preheader -> %exit probability is 0x40000000 / 0x80000000 = 50.00%
Expand All @@ -664,18 +664,18 @@ entry:
br label %preheader

preheader:
br i1 undef, label %loop, label %exit
br i1 %arg, label %loop, label %exit

loop:
%i.0 = phi i32 [ 0, %preheader ], [ %inc, %cont2 ]
%inc = add nsw i32 %i.0, 1
br i1 undef, label %cont, label %noreturn
br i1 %arg, label %cont, label %noreturn

cont:
br i1 undef, label %cont2, label %cold
br i1 %arg, label %cont2, label %cold

cont2:
br i1 undef, label %loop, label %exit
br i1 %arg, label %loop, label %exit

noreturn:
call void @abort()
Expand All @@ -692,7 +692,7 @@ exit:

; This is case with two loops where one nested into another. Nested loop has
; low probable exit what encreases robability to take exit in the top level loop.
define void @test18() {
define void @test18(i1 %arg) {
; CHECK: edge %entry -> %top.loop probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
; CHECK: edge %top.loop -> %loop probability is 0x546cd4b7 / 0x80000000 = 65.96%
; CHECK: edge %top.loop -> %exit probability is 0x2b932b49 / 0x80000000 = 34.04%
Expand All @@ -705,12 +705,12 @@ entry:

top.loop:
%j.0 = phi i32 [ 0, %entry ], [ %j.inc, %cold ]
br i1 undef, label %loop, label %exit
br i1 %arg, label %loop, label %exit

loop:
%i.0 = phi i32 [ %j.0, %top.loop ], [ %inc, %loop ]
%inc = add nsw i32 %i.0, 1
br i1 undef, label %loop, label %cold
br i1 %arg, label %loop, label %cold

cold:
call void @cold()
Expand Down
Loading

0 comments on commit 30c80a2

Please sign in to comment.