[llvm] [VPlan] Add initial CFG simplification, removing BranchOnCond true. (PR #106748)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 6 06:48:52 PDT 2024
================
@@ -1017,9 +1017,17 @@ void VPlan::execute(VPTransformState *State) {
"middle block has unexpected successors");
VPBasicBlock *ScalarPhVPBB = cast<VPBasicBlock>(
MiddleSuccs.size() == 1 ? MiddleSuccs[0] : MiddleSuccs[1]);
- assert(!isa<VPIRBasicBlock>(ScalarPhVPBB) &&
- "scalar preheader cannot be wrapped already");
- replaceVPBBWithIRVPBB(ScalarPhVPBB, ScalarPh);
+ if (!isa<VPIRBasicBlock>(ScalarPhVPBB)) {
+ replaceVPBBWithIRVPBB(ScalarPhVPBB, ScalarPh);
+ } else {
+ // There is no edge to the scalar pre-header in VPlan. Phis in ScalarPh have
+ // been created during skeleton construction, so remove the incoming values
+ // from the middle block here.
+ // TODO: Remove this once phis in the scalar preheader are managed in VPlan
+ // directly.
+ for (auto &Phi : ScalarPh->phis())
----------------
fhahn wrote:
It was needed to remove live-outs. I've now updated the PR to be based on
https://github.com/llvm/llvm-project/pull/110577 and https://github.com/llvm/llvm-project/pull/109975, which removes the need for those changes.
https://github.com/llvm/llvm-project/pull/106748
More information about the llvm-commits
mailing list