aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/IfConversion.cpp
diff options
context:
space:
mode:
authorMikael Holmen <mikael.holmen@ericsson.com>2020-04-08 11:58:26 +0200
committerMikael Holmen <mikael.holmen@ericsson.com>2020-04-08 12:50:36 +0200
commit893df2032d480bf791a69fe965c3ca4ef500145b (patch)
treea7dd655b09ca6bf597e265df1906f8af457af265 /llvm/lib/CodeGen/IfConversion.cpp
parent89e1248d7b76886912f499391719e68b27e42ec3 (diff)
downloadllvm-893df2032d480bf791a69fe965c3ca4ef500145b.zip
llvm-893df2032d480bf791a69fe965c3ca4ef500145b.tar.gz
llvm-893df2032d480bf791a69fe965c3ca4ef500145b.tar.bz2
[IfConversion] Disallow TrueBB == FalseBB for valid diamonds
Summary: This fixes PR45302. Previously the case BB1 / \ | | TBB FBB | | \ / BB2 was treated as a valid diamond also when TBB and FBB was the same basic block. This then lead to a failed assertion in IfConvertDiamond. Since TBB == FBB is quite a degenerated case of a diamond, we now don't treat it as a valid diamond anymore, and thus we will avoid the trouble of making IfConvertDiamond handle it correctly. Reviewers: efriedma, kparzysz Reviewed By: efriedma Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D77651
Diffstat (limited to 'llvm/lib/CodeGen/IfConversion.cpp')
-rw-r--r--llvm/lib/CodeGen/IfConversion.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/IfConversion.cpp b/llvm/lib/CodeGen/IfConversion.cpp
index 77fa128..90c471c 100644
--- a/llvm/lib/CodeGen/IfConversion.cpp
+++ b/llvm/lib/CodeGen/IfConversion.cpp
@@ -972,6 +972,11 @@ bool IfConverter::ValidDiamond(
FalseBBI.IsBeingAnalyzed || FalseBBI.IsDone)
return false;
+ // If the True and False BBs are equal we're dealing with a degenerate case
+ // that we don't treat as a diamond.
+ if (TrueBBI.BB == FalseBBI.BB)
+ return false;
+
MachineBasicBlock *TT = TrueBBI.TrueBB;
MachineBasicBlock *FT = FalseBBI.TrueBB;