[PATCH] D110060: [LoopBoundSplit] Handle the case in which exiting block is loop header

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 3 20:13:08 PDT 2021


mkazantsev added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopBoundSplit.cpp:66
+    const SCEV *BoundSCEV = SE.getSCEV(Cond.BoundValue);
+    const SCEVAddRecExpr *LHSAddRecSCEV = dyn_cast<SCEVAddRecExpr>(AddRecSCEV);
+    const SCEVAddRecExpr *RHSAddRecSCEV = dyn_cast<SCEVAddRecExpr>(BoundSCEV);
----------------
mkazantsev wrote:
> Cast not needed.
Ignore this, I misread the code.


================
Comment at: llvm/lib/Transforms/Scalar/LoopBoundSplit.cpp:69
     // Locate AddRec in LHSSCEV and Bound in RHSSCEV.
-    if (isa<SCEVAddRecExpr>(Cond.BoundSCEV) &&
-        !isa<SCEVAddRecExpr>(Cond.AddRecSCEV)) {
+    if (!LHSAddRecSCEV && RHSAddRecSCEV) {
       std::swap(Cond.AddRecValue, Cond.BoundValue);
----------------
mkazantsev wrote:
> I guess this is impossible after you've ensured that `AddRecSCEV` is an addrec actually. Or can it be null?
Ignore this too.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110060/new/

https://reviews.llvm.org/D110060



More information about the llvm-commits mailing list