[Mlir-commits] [mlir] Folding extract_strided_metadata input into reinterpret_cast on constant layout (PR #134845)

Matthias Springer llvmlistbot at llvm.org
Tue Apr 8 05:59:46 PDT 2025


================
@@ -1973,6 +1994,22 @@ OpFoldResult ReinterpretCastOp::fold(FoldAdaptor /*operands*/) {
   return nullptr;
 }
 
+bool ReinterpretCastOp::isLayoutConstant() {
+  if (llvm::all_of(
+          getOffsets(),
+          [](OpFoldResult val) { return isConstantIntValue(val, 0); }) &&
----------------
matthias-springer wrote:

This function seems to check that all offsets, sizes, strides are `0`. Is that what you intended? I think you want `getConstantIntValue(val) != std::nullopt`.


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


More information about the Mlir-commits mailing list