[PATCH] D155389: [ValueTracking][ScalarEvolution] improving llvm.assume's support for the argument value without context & reducing the result range of ScalarEvolution::getRange using computeConstantRange

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 20 05:45:11 PDT 2023


arsenm added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:6868-6873
+    if (U->getType()->isIntOrIntVectorTy()) {
+      ConstantRange Range = computeConstantRange(
+          U->getValue(), SignHint == ScalarEvolution::HINT_RANGE_SIGNED, true,
+          &AC, nullptr, &DT);
+      ConservativeResult = ConservativeResult.intersectWith(Range, RangeType);
+    }
----------------
This is a separate change


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:103
+  const BasicBlock &B = A->getParent()->getEntryBlock();
+  return B.empty() ? nullptr : &B.front();
+}
----------------
An empty block isn't well formed IR, does it really need to handle that


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:119
 
+  CxtI = getArgCxtI(dyn_cast<Argument>(V));
+  if (CxtI && CxtI->getParent())
----------------
Instead of pretending arguments are at the first instruction, could we just directly attach ranges to Arguments (by an attribute)


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

https://reviews.llvm.org/D155389



More information about the llvm-commits mailing list