[PATCH] D98697: [IndVars] Provide eliminateIVComparison with context

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 16 04:44:25 PDT 2021


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyIndVar.cpp:265
+  // If the condition is always true or always false, in the given context,
+  // replace it witha constant value.
+  // TODO: We can sharpen the context to common dominator of all ICmp's users.
----------------



================
Comment at: llvm/lib/Transforms/Utils/SimplifyIndVar.cpp:267
+  // TODO: We can sharpen the context to common dominator of all ICmp's users.
+  const Instruction *Context = ICmp;
+  if (SE->isKnownPredicateAt(Pred, S, X, Context)) {
----------------
It's usually called `CtxI`


================
Comment at: llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll:822
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[LENGTH:%.*]] = load i32, i32* [[LENGTH_PTR:%.*]], align 4, [[RNG0]]
+; CHECK-NEXT:    [[LENGTH:%.*]] = load i32, i32* [[LENGTH_PTR:%.*]], align 4, !range [[RNG0]]
 ; CHECK-NEXT:    [[ENTRY_COND:%.*]] = icmp sgt i32 [[LENGTH]], 1
----------------
Please precommit, it's a bit noisy.


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

https://reviews.llvm.org/D98697



More information about the llvm-commits mailing list