[PATCH] D145929: [LSR]: Fold terminating condition not only for eq and ne.

Yueh-Ting (eop) Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 00:05:39 PDT 2023


eopXD added a comment.

Thank you for looking into this! Some comments and I think we are good to go.



================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:3164
   LLVM_DEBUG(dbgs() << "Final Chain: " << *Chain.Incs[0].UserInst << "\n");
-  
   for (const IVInc &Inc : Chain) {
----------------
I think this is change un-related to the topic of this patch.


================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:6307
         continue;
-      } 
 
----------------
Ditto.


================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:6711
+  if (!isa<ICmpInst>(TermCond)) {
+    LLVM_DEBUG(dbgs() << "Cannot fold on branching condition that is not ICmp\n");
     return std::nullopt;
----------------
Please add test coverage for this, thank you.


================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:6720
   }
+  if (!isGuaranteedNotToBeUndefOrPoison(TermCond)) {
+    LLVM_DEBUG(
----------------
Ditto, test coverage :)


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

https://reviews.llvm.org/D145929



More information about the llvm-commits mailing list