[PATCH] D98147: [SCEV] Improve modelling for pointer constants

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 10 13:08:04 PST 2021


Meinersbur added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:1075-1080
+    // Does the operand happen to be a (pointer) constant? If so, see if we can
+    // produce an integer constant (but *NOT* an ptr2int constant expression!).
+    if (auto *PC = dyn_cast<Constant>(U->getValue()))
+      if (auto *IC =
+              ConstantExpr::getPtrToInt(PC, IntPtrTy, /*OnlyIfReduced=*/true))
+        return getTruncateOrZeroExtend(getSCEV(IC), Ty);
----------------
Alternatively, I suggest we point-out that SCEV canonicalization is deferred to LLVM's ConstantFold and check that it really has been removed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98147



More information about the llvm-commits mailing list