[PATCH] D151698: [SCEV] Compute AddRec range computations using different type BECount

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 30 03:54:18 PDT 2023


nikic requested changes to this revision.
nikic added a comment.
This revision now requires changes to proceed.

Nice find! It looks like there are some polly tests that need updating.



================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:6796
+        if (BEBitWidth > BitWidth &&
+            static_cast<const SCEVConstant *>(MaxBECount)
+                ->getAPInt()
----------------
static_cast -> cast


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:6798
+                ->getAPInt()
+                .ule(APInt::getMaxValue(BitWidth).zext(BEBitWidth))) {
+          MaxBECount = getTruncateExpr(MaxBECount, AddRec->getType());
----------------
`.getActiveBits() <= BitWidth`?


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:6805
+          auto RangeFromAffine = getRangeForAffineAR(
+              AddRec->getStart(), AddRec->getStepRecurrence(*this), MaxBECount,
+              BitWidth);
----------------
It would probably make sense to convert this MaxBECount argument into an APInt (maybe as an NFC-refactoring before this change)?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151698



More information about the llvm-commits mailing list