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

JinGu Kang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 23 00:37:40 PDT 2021


jaykang10 added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopBoundSplit.cpp:81
+    // value from backedge.
+    if (Cond.AddRecSCEV && isa<PHINode>(Cond.AddRecValue)) {
+      PHINode *PN = cast<PHINode>(Cond.AddRecValue);
----------------
mkazantsev wrote:
> You can use `L.getLoopPreheader` or `L.getLoopPredecessor` to find a block from which a non-loop value is coming.
Yep, let me update it.


================
Comment at: llvm/test/Transforms/LoopBoundSplit/bug51866.ll:39
+; CHECK-NEXT:    [[I_0_SPLIT:%.*]] = phi i16 [ [[INC_SPLIT:%.*]], [[FOR_INC_SPLIT:%.*]] ], [ 5, [[FOR_COND_SPLIT_PREHEADER]] ]
+; CHECK-NEXT:    [[I_1_SPLIT:%.*]] = phi i16 [ [[INC_SPLIT]], [[FOR_INC_SPLIT]] ], [ 10, [[FOR_COND_SPLIT_PREHEADER]] ]
+; CHECK-NEXT:    [[EXITCOND_NOT_SPLIT:%.*]] = icmp eq i16 [[I_0_SPLIT]], 10
----------------
mkazantsev wrote:
> Why is it 10 again?
Ah, you are right! I made a mistake. The incoming value from preheader in post-loop should be new bound. Let me update it.


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

https://reviews.llvm.org/D110060



More information about the llvm-commits mailing list