[PATCH] D88527: [IndVars] Replace checks with invariants if we cannot remove them

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 11 19:18:32 PST 2020


anna added a comment.

Just a stylistic comment. You can have the `InvariantCond` as a struct with the fields: `InvariantPred, InvariantLHS, InvariantRHS`. I think this will make code more readable (for example, use the struct in `ReplaceInvariantCond(ExitingBB, InvariantCond)`.



================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:2359
     return CanBeRemoved;
-  return CannotOptimize;
+  return CanBeReplacedWithInvariant;
 }
----------------
I maybe missing something. Where are we checking the "never fails in any iteration other than the first" ? 


================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:2437
 
+  auto ReplaceInvariantCond = [&](
+      BasicBlock *ExitingBB, ICmpInst::Predicate InvariantPred,
----------------
Nit: ReplaceWithInvariantCond.


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

https://reviews.llvm.org/D88527



More information about the llvm-commits mailing list