[llvm] [polly] [delinearize] Extract array dimensions from alloca and global declarations (PR #156342)

Sebastian Pop via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 10 10:07:00 PDT 2025


================
@@ -484,6 +650,21 @@ static std::optional<APInt> tryIntoAPInt(const SCEV *S) {
   return std::nullopt;
 }
 
+/// Convert cached SCEV sizes to int sizes for compatibility.
+/// TODO: Remove this after we remove GEP delinearization.
+static void convertSCEVSizesToIntSizes(ArrayRef<const SCEV *> SCEVSizes,
+                                       SmallVectorImpl<int> &Sizes) {
+  for (const SCEV *S : SCEVSizes) {
+    if (auto *Const = dyn_cast<SCEVConstant>(S)) {
+      const APInt &APVal = Const->getAPInt();
+      if (APVal.isSignedIntN(32)) {
+        int intValue = APVal.getSExtValue();
+        Sizes.push_back(intValue);
+      }
----------------
sebpop wrote:

Clean-up posted here: https://github.com/llvm/llvm-project/pull/162888
Once that gets committed I will update the current PR and remove the above loop and conversions for Sizes vector from SCEV to int and back to SCEV.

https://github.com/llvm/llvm-project/pull/156342


More information about the llvm-commits mailing list