[PATCH] D99774: [LoopUtils] Populate sibling loops in reverse program order on new pass manager

JinGu Kang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 16 09:20:20 PDT 2021


jaykang10 added a comment.

I am seeing the forward one is worse than reverse one on IRCE pass. The pass checks whether it safely calculates the bounds of a new loop using `isLoopEntryGuardedByCond` which climbs up the predecessor chain of loop header. If the previous loop has already been transformed with the IRCE pass, the current loop sometimes fails to calculate the bounds of a new loop.
The IRCE pass is function pass and it uses `appendLoopsToWorklist` which adds loops in forward program order. Can we add `appendReverseLoopsToWorklist` or something like that please? It is not easy to guarantee which order is always better but each pass could know which one is better. How do you think about it?



================
Comment at: llvm/test/Transforms/IndVarSimplify/scev-expander-preserve-lcssa.ll:122
+; CHECK-NEXT:    [[CMP82:%.*]] = icmp slt i32 [[INC]], [[I_0_LCSSA2]]
+; CHECK-NEXT:    br i1 [[CMP82]], label [[FOR_BODY84]], label [[RETURN_LOOPEXIT]]
 ; CHECK:       return.loopexit:
----------------
fhahn wrote:
> This seems like a regression?
Yep, the reverse one is not always better than forward one...


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

https://reviews.llvm.org/D99774



More information about the llvm-commits mailing list