[PATCH] D42691: [SimplifyCFG] Relax restriction for folding unconditional branches
Serguei Katkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 4 20:19:21 PST 2018
skatkov added inline comments.
================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:5740
Options.NeedCanonicalLoop &&
- (LoopHeaders && (LoopHeaders->count(BB) || LoopHeaders->count(Succ)));
+ (LoopHeaders && std::distance(pred_begin(BB), pred_end(BB)) > 1 &&
+ (LoopHeaders->count(BB) || LoopHeaders->count(Succ)));
----------------
efriedma wrote:
> getSinglePredecessor()?
make sense.
================
Comment at: test/Transforms/SimplifyCFG/UncondBranchToHeader.ll:16
+ br label %header
+exit:
+ ret i32 %i
----------------
efriedma wrote:
> Do we really need SimplifyCFG to rotate loops? We have a dedicated LoopRotate pass for this sort of transform.
>
> But I guess it's okay.
Hi Eli, I did not follow what you mean here as rotate loop?
Header will be the same. In this particular case the loop will just consists from one basic block header after transformation...
https://reviews.llvm.org/D42691
More information about the llvm-commits
mailing list