[llvm] [SimplifyCFG] Avoid introducing complex phi when removing empty blocks (PR #104887)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 20 15:02:10 PDT 2024
================
@@ -1040,6 +1045,42 @@ CanRedirectPredsOfEmptyBBToSucc(BasicBlock *BB, BasicBlock *Succ,
return true;
}
+// Check whether removing BB will make the phis in its Succ will have too
+// many incoming entries. This function does not check whether BB is foldable
+// or not.
+static bool introduceTooComplexPhi(BasicBlock *BB) {
+ // Check BB only has phi and an unconditional branch
+ BranchInst *Branch = dyn_cast<BranchInst>(BB->getFirstNonPHIOrDbg(true));
+ assert(Branch && Branch->isUnconditional() && "BB is not an empty block");
----------------
Chengjunp wrote:
I see. Thank you for pointing this out. I will update this.
https://github.com/llvm/llvm-project/pull/104887
More information about the llvm-commits
mailing list