[llvm] [ValueTracking] AllowEphemerals for alignment assumptions. (PR #108632)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 16 01:56:11 PDT 2024


================
@@ -820,9 +820,12 @@ void llvm::computeKnownBitsFromContext(const Value *V, KnownBits &Known,
         continue;
       if (RetainedKnowledge RK = getKnowledgeFromBundle(
               *I, I->bundle_op_info_begin()[Elem.Index])) {
+        // Allow AllowEphemerals in isValidAssumeForContext, as the CxtI might
+        // be the producer of the pointer in the bundle. At the moment, align
+        // assumptions aren't optimized away.
         if (RK.WasOn == V && RK.AttrKind == Attribute::Alignment &&
             isPowerOf2_64(RK.ArgValue) &&
-            isValidAssumeForContext(I, Q.CxtI, Q.DT))
+            isValidAssumeForContext(I, Q.CxtI, Q.DT, /*AllowEphemerals*/ true))
----------------
david-arm wrote:

I *think* this should be safe, since `computeKnownBitsFromContext` isn't actually changing any IR here. It's simply using information in the assume intrinsic to figure out the range of pointer values.

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


More information about the llvm-commits mailing list