[llvm-branch-commits] [clang] [llvm] [mlir] [AMDGPU] Canonicalize num_records to its actual width in InstCombine (PR #217068)

Krzysztof Drewniak via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Aug 18 11:18:50 PDT 2026


================
@@ -891,16 +891,17 @@ LegalizeBufferContentTypesVisitor::analyzeOobProperties(Value *Ptr, Type *Ty,
   if (NumRecords->isAllOnesValue())
     Result.NoPartialOOB = true;
 
-  const SCEV *BoundsDiff;
-  if (ST->has45BitNumRecordsBufferResource()) {
-    const SCEV *PtrDiffExt =
-        SE->getNoopOrZeroExtend(PtrDiff, NumRecords->getType());
-    BoundsDiff = SE->getMinusSCEV(NumRecords, PtrDiffExt);
-  } else {
-    const SCEV *NumRecordsI32 =
-        SE->getTruncateOrNoop(NumRecords, IRB.getInt32Ty());
-    BoundsDiff = SE->getMinusSCEV(NumRecordsI32, PtrDiff);
-  }
+  // If we don't know how wide num_records is, conservatively avoid truncating
----------------
krzysz00 wrote:

True - this might want to be a separate stack of PRs. Will split

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


More information about the llvm-branch-commits mailing list