[llvm] DSE: lift limitation on sizes being non-scalable (PR #110670)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 05:58:20 PDT 2024


================
@@ -1016,30 +1016,45 @@ struct DSEState {
       return isMaskedStoreOverwrite(KillingI, DeadI, BatchAA);
     }
 
-    const TypeSize KillingSize = KillingLocSize.getValue();
-    const TypeSize DeadSize = DeadLoc.Size.getValue();
-    // Bail on doing Size comparison which depends on AA for now
-    // TODO: Remove AnyScalable once Alias Analysis deal with scalable vectors
-    const bool AnyScalable =
-        DeadSize.isScalable() || KillingLocSize.isScalable();
-
-    if (AnyScalable)
-      return OW_Unknown;
+    APInt KillingSize = APInt(64, KillingLocSize.getValue().getKnownMinValue());
+    APInt DeadSize = APInt(64, DeadLoc.Size.getValue().getKnownMinValue());
+
+    // We can compare lower-range(KillingSize) with upper-range(DeadSize), using
+    // VScale.
+    ConstantRange CR = getVScaleRange(&F, 64);
----------------
artagnon wrote:

Thanks, writing the extra tests exposed bugs, which I have fixed now!

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


More information about the llvm-commits mailing list