[PATCH] D48202: Generalize MergeBlockIntoPredecessor. Replace uses of MergeBasicBlockIntoOnlyPred.
Alina Sbirlea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 19 11:09:02 PDT 2018
asbirlea marked 4 inline comments as done.
asbirlea added a comment.
Updated scev.ll to be fully parametric (vs updating one label). All other tests should use variables as well, but that can be a separate cleanup.
================
Comment at: lib/Transforms/Utils/BasicBlockUtils.cpp:146
// Can't merge if there are multiple successors.
if (!OnlySucc) return false;
----------------
dmgreen wrote:
> asbirlea wrote:
> > dmgreen wrote:
> > > This and the previous block is just (PredBB->getUniqueSuccessor() == BB)?
> > This method is expected to also merge blocks when there are multiple edges from PredBB to BB.
> > Example: `test/Transforms/SimplifyCFG/2003-08-17-FoldSwitch.ll: test3`
> >
> > ```
> > Start: ; preds = %0
> > switch i32 3, label %TheDest [
> > i32 0, label %TheDest
> > i32 1, label %TheDest
> > i32 2, label %TheDest
> > i32 5, label %TheDest
> > ]
> > TheDest:
> > ret i32 1234
> > ```
> I believe this is what getUniqueSuccessor does (as opposed to getSingleSuccessor). You are not making things any worse by leaving it as it is though.
Ah, I missed the difference from getSingleSuccessor. Thank you for following up!
Repository:
rL LLVM
https://reviews.llvm.org/D48202
More information about the llvm-commits
mailing list