[llvm] [Matrix] Use data layout index type for lowering matrix intrinsics (PR #162646)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 9 05:59:00 PDT 2025


================
@@ -1295,6 +1302,19 @@ class LowerMatrixIntrinsics {
     return commonAlignment(InitialAlign, ElementSizeInBits / 8);
   }
 
+  IntegerType *getIndexType(Value *Ptr) const {
+    return cast<IntegerType>(DL.getIndexType(Ptr->getType()));
+  }
+
+  Value *getIndex(Value *Ptr, uint64_t V) const {
+    return ConstantInt::get(getIndexType(Ptr), V);
+  }
+
+  Value *truncateToIndexType(Value *Ptr, Value *V, IRBuilder<> &Builder) const {
----------------
fhahn wrote:

This truncates or extends. Would be good to document, and explain why this uses a zero extend if needed.

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


More information about the llvm-commits mailing list