-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove br i1 undef
from regression tests
#115130
base: main
Are you sure you want to change the base?
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-debuginfo @llvm/pr-subscribers-backend-systemz Author: Lee Wei (leewei05) ChangesAs defined in LangRef, branching on Here's an Alive2 proof for one of the examples: https://alive2.llvm.org/ce/z/TncxhP There are still many @nunoplopes @regehr Patch is 212.69 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/115130.diff 91 Files Affected:
diff --git a/llvm/test/Analysis/BasicAA/phi-values-usage.ll b/llvm/test/Analysis/BasicAA/phi-values-usage.ll
index 4c5f071ab96692..43df41c9164180 100644
--- a/llvm/test/Analysis/BasicAA/phi-values-usage.ll
+++ b/llvm/test/Analysis/BasicAA/phi-values-usage.ll
@@ -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
@@ -50,7 +50,7 @@ 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
@@ -58,7 +58,7 @@ entry:
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
diff --git a/llvm/test/Analysis/BasicAA/underlying-value.ll b/llvm/test/Analysis/BasicAA/underlying-value.ll
index 4d267af8c44438..36c0c266e9a19a 100644
--- a/llvm/test/Analysis/BasicAA/underlying-value.ll
+++ b/llvm/test/Analysis/BasicAA/underlying-value.ll
@@ -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
diff --git a/llvm/test/Analysis/BlockFrequencyInfo/irreducible_loop_crash.ll b/llvm/test/Analysis/BlockFrequencyInfo/irreducible_loop_crash.ll
index b2aa0648c0a92f..09fe7e50e69cf0 100644
--- a/llvm/test/Analysis/BlockFrequencyInfo/irreducible_loop_crash.ll
+++ b/llvm/test/Analysis/BlockFrequencyInfo/irreducible_loop_crash.ll
@@ -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
@@ -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
diff --git a/llvm/test/Analysis/BranchProbabilityInfo/deopt-invoke.ll b/llvm/test/Analysis/BranchProbabilityInfo/deopt-invoke.ll
index f6b906b95ec6ee..0dbfdfdeb34ca6 100644
--- a/llvm/test/Analysis/BranchProbabilityInfo/deopt-invoke.ll
+++ b/llvm/test/Analysis/BranchProbabilityInfo/deopt-invoke.ll
@@ -8,7 +8,7 @@ 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%
@@ -16,7 +16,7 @@ define void @test1(i32 %0) personality ptr @"personality_function" !prof !1 {
;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
@@ -38,7 +38,7 @@ 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]
@@ -46,7 +46,7 @@ define void @test2(i32 %0) personality ptr @"personality_function" {
;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
@@ -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
diff --git a/llvm/test/Analysis/BranchProbabilityInfo/loop.ll b/llvm/test/Analysis/BranchProbabilityInfo/loop.ll
index 0b02cedf03df3e..ffac1cd4666415 100644
--- a/llvm/test/Analysis/BranchProbabilityInfo/loop.ll
+++ b/llvm/test/Analysis/BranchProbabilityInfo/loop.ll
@@ -523,7 +523,7 @@ 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]
@@ -531,12 +531,12 @@ define void @test13() {
; 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()
@@ -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]
@@ -556,7 +556,7 @@ 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
@@ -564,7 +564,7 @@ preheader:
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()
@@ -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]
@@ -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
@@ -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]
@@ -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
@@ -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%
@@ -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()
@@ -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%
@@ -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()
diff --git a/llvm/test/Analysis/BranchProbabilityInfo/unreachable.ll b/llvm/test/Analysis/BranchProbabilityInfo/unreachable.ll
index d3ada520c4dac9..1de1893a729111 100644
--- a/llvm/test/Analysis/BranchProbabilityInfo/unreachable.ll
+++ b/llvm/test/Analysis/BranchProbabilityInfo/unreachable.ll
@@ -5,7 +5,7 @@ declare void @bar() cold
; Both 'l1' and 'r1' has one edge leading to 'cold' and another one to
; 'unreachable' blocks. Check that 'cold' paths are preferred. Also ensure both
; paths from 'entry' block are equal.
-define void @test1(i32 %0) {
+define void @test1(i32 %0, i1 %arg) {
;CHECK: edge %entry -> %l1 probability is 0x40000000 / 0x80000000 = 50.00%
;CHECK: edge %entry -> %r1 probability is 0x40000000 / 0x80000000 = 50.00%
;CHECK: edge %l1 -> %cold probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
@@ -14,13 +14,13 @@ define void @test1(i32 %0) {
;CHECK: edge %r1 -> %cold probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
entry:
- br i1 undef, label %l1, label %r1
+ br i1 %arg, label %l1, label %r1
l1:
- br i1 undef, label %cold, label %unreached
+ br i1 %arg, label %cold, label %unreached
r1:
- br i1 undef, label %unreached, label %cold
+ br i1 %arg, label %unreached, label %cold
unreached:
unreachable
@@ -33,7 +33,7 @@ cold:
; Both edges of 'l1' leads to 'cold' blocks while one edge of 'r1' leads to
; 'unreachable' block. Check that 'l1' has 50/50 while 'r1' has 0/100
; distributuion. Also ensure both paths from 'entry' block are equal.
-define void @test2(i32 %0) {
+define void @test2(i32 %0, i1 %arg) {
;CHECK: edge %entry -> %l1 probability is 0x40000000 / 0x80000000 = 50.00%
;CHECK: edge %entry -> %r1 probability is 0x40000000 / 0x80000000 = 50.00%
;CHECK: edge %l1 -> %cold probability is 0x40000000 / 0x80000000 = 50.00%
@@ -42,13 +42,13 @@ define void @test2(i32 %0) {
;CHECK: edge %r1 -> %cold probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
entry:
- br i1 undef, label %l1, label %r1
+ br i1 %arg, label %l1, label %r1
l1:
- br i1 undef, label %cold, label %cold2
+ br i1 %arg, label %cold, label %cold2
r1:
- br i1 undef, label %unreached, label %cold
+ br i1 %arg, label %unreached, label %cold
unreached:
unreachable
@@ -64,7 +64,7 @@ cold2:
; Both edges of 'r1' leads to 'unreachable' blocks while one edge of 'l1' leads to
; 'cold' block. Ensure that path leading to 'cold' block is preferred.
-define void @test3(i32 %0) {
+define void @test3(i32 %0, i1 %arg) {
;CHECK: edge %entry -> %l1 probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
;CHECK: edge %entry -> %r1 probability is 0x00000000 / 0x80000000 = 0.00%
;CHECK: edge %l1 -> %cold probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
@@ -73,13 +73,13 @@ define void @test3(i32 %0) {
;CHECK: edge %r1 -> %unreached2 probability is 0x40000000 / 0x80000000 = 50.00%
entry:
- br i1 undef, label %l1, label %r1
+ br i1 %arg, label %l1, label %r1
l1:
- br i1 undef, label %cold, label %unreached
+ br i1 %arg, label %cold, label %unreached
r1:
- br i1 undef, label %unreached, label %unreached2
+ br i1 %arg, label %unreached, label %unreached2
unreached:
unreachable
@@ -95,7 +95,7 @@ cold:
; Left edge of 'entry' leads to 'cold' block while right edge is 'normal' continuation.
; Check that we able to propagate 'cold' weight to 'entry' block. Also ensure
; both edges from 'l1' are equally likely.
-define void @test4(i32 %0) {
+define void @test4(i32 %0, i1 %arg) {
;CHECK: edge %entry -> %l1 probability is 0x078780e3 / 0x80000000 = 5.88%
;CHECK: edge %entry -> %r1 probability is 0x78787f1d / 0x80000000 = 94.12% [HOT edge]
;CHECK: edge %l1 -> %l2 probability is 0x40000000 / 0x80000000 = 50.00%
@@ -105,10 +105,10 @@ define void @test4(i32 %0) {
;CHECK: edge %to.cold -> %cold probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
entry:
- br i1 undef, label %l1, label %r1
+ br i1 %arg, label %l1, label %r1
l1:
- br i1 undef, label %l2, label %r2
+ br i1 %arg, label %l2, label %r2
l2:
br label %to.cold
@@ -128,7 +128,7 @@ cold:
}
; Check that most likely path from 'entry' to 'l2' through 'r1' is preferred.
-define void @test5(i32 %0) {
+define void @test5(i32 %0, i1 %arg) {
;CHECK: edge %entry -> %cold probability is 0x078780e3 / 0x80000000 = 5.88%
;CHECK: edge %entry -> %r1 probability is 0x78787f1d / 0x80000000 = 94.12% [HOT edge]
;CHECK: edge %cold -> %l2 probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
@@ -136,14 +136,14 @@ define void @test5(i32 %0) {
;CHECK: edge %r1 -> %unreached probability is 0x00000000 / 0x80000000 = 0.00%
entry:
- br i1 undef, label %cold, label %r1
+ br i1 %arg, label %cold, label %r1
cold:
call void @bar()
br label %l2
r1:
- br i1 undef, label %l2, label %unreached
+ br i1 %arg, label %l2, label %unreached
l2:
ret void
diff --git a/llvm/test/Analysis/CostModel/SystemZ/intrinsic-cost-crash.ll b/llvm/test/Analysis/CostModel/SystemZ/intrinsic-cost-crash.ll
index d8a864a85ed59d..ecc7fc8fdb98a0 100644
--- a/llvm/test/Analysis/CostModel/SystemZ/intrinsic-cost-crash.ll
+++ b/llvm/test/Analysis/CostModel/SystemZ/intrinsic-cost-crash.ll
@@ -26,12 +26,12 @@
declare void @llvm.lifetime.end(i64, ptr nocapture) #0
; Function Attrs: nounwind ssp uwtable
-define hidden void @fun(ptr %N) #1 align 2 {
+define hidden void @fun(ptr %N, i1 %arg) #1 align 2 {
; CHECK: define
entry:
%NumOperands.i = getelementptr inbounds %"class.llvm::SDNode.310.1762.9990.10474.10958.11442.11926.12410.12894.13378.13862.15314.15798.16282.17734.19186.21122.25962.26930.29350.29834.30318.30802.31286.31770.32254.32738.33706.36610.38062.41642", ptr %N, i64 0, i32 8
%0 = load i16, ptr %NumOperands.i, align 8, !tbaa !1
- br i1 undef, label %for.cond.cleanup, label %for.body.lr.ph
+ br i1 %arg, label %for.cond.cleanup, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%wide.trip.count192 = zext i16 %0 to i64
diff --git a/llvm/test/Analysis/CycleInfo/basic.ll b/llvm/test/Analysis/CycleInfo/basic.ll
index e459b0c317f948..33e5227b162fd3 100644
--- a/llvm/test/Analysis/CycleInfo/basic.ll
+++ b/llvm/test/Analysis/CycleInfo/basic.ll
@@ -7,36 +7,36 @@ define void @empty() {
ret void
}
-define void @simple() {
+define void @simple(i1 %arg) {
; CHECK-LABEL: CycleInfo for function: simple
; CHECK: depth=1: entries(loop)
entry:
br label %loop
loop:
- br i1 undef, label %loop, label %exit
+ br i1 %arg, label %loop, label %exit
exit:
ret void
}
-define void @two_latches() {
+define void @two_latches(i1 %arg) {
; CHECK-LABEL: CycleInfo for function: two_latches
; CHECK: depth=1: entries(loop) loop_next
entry:
br label %loop
loop:
- br i1 undef, label %loop, label %loop_next
+ br i1 %arg, label %loop, label %loop_next
loop_next:
- br i1 undef, label %exit, label %loop
+ br i1 %arg, label %exit, label %loop
exit:
ret void
}
-define void @nested_simple() {
+define void @nested_simple(i1 %arg) {
; CHECK-LABEL: CycleInfo for function: nested_simple
; CHECK: depth=1: entries(outer_header) outer_latch inner
; CHECK: depth=2: entries(inner)
@@ -47,16 +47,16 @@ outer_header:
br label %inner
inner:
- br i1 undef, label %inner, label %outer_latch
+ br i1 %arg, label %inner, label %outer_latch
outer_latch:
- br i1 undef, label %outer_header, label %exit
+ br i1 %arg, label %outer_header, label %exit
exit:
ret void
}
-define void @nested_outer_latch_in_inner_loop() {
+define void @nested_outer_latch_in_inner_loop(i1 %arg) {
; CHECK-LABEL: CycleInfo for function: nested_outer_latch_in_inner_loop
; CHECK: depth=1: entries(outer_header) inner_header inner_latch
; CHECK: depth=2: entries(inner_header) inner_latch
@@ -67,33 +67...
[truncated]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, thanks!
The MemorySSA tests you changed to use the automatic output checking must be reverted. You must keep the old checks. The auto-generated ones aren't checking the same thing. The old ones were checking that the memory phis were in the right place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes in the DebugInfo directory look good.
I get the feeling that earlydup-crash.ll is the most likely to accidentally lose some tests coverage, as it's a crash-test with a broad input that (potentially) generates substantially different code for well-defined branches rather than undef branches. However, given that IIRC undef branches will eventually not be supported by LLVM, this is unavoidable.
ok, then we can leave that test with |
As defined in LangRef, branching on
undef
is undefined behavior.This PR aims to remove undefined behavior from tests. As UB tests break Alive2 and may be the root cause of breaking future optimizations.
Here's an Alive2 proof for one of the examples: https://alive2.llvm.org/ce/z/TncxhP
There are still many
br i1 undef
underllvm/test/Transforms
andllvm/test/Codegen
.I'll create more PRs to fix these tests.
@nunoplopes @regehr