[Mlir-commits] [mlir] [MLIR][Affine] Update ::fold() to have constant basis attr for affine.delinearize_index/linearize_index wherever applicable (PR #117572)

Krzysztof Drewniak llvmlistbot at llvm.org
Wed Nov 27 11:40:25 PST 2024


================
@@ -4789,6 +4829,15 @@ LogicalResult AffineLinearizeIndexOp::verify() {
 }
 
 OpFoldResult AffineLinearizeIndexOp::fold(FoldAdaptor adaptor) {
+  std::optional<SmallVector<int64_t>> maybeStaticBasis =
+      foldCstValueToCstAttrBasis(getMixedBasis(), getDynamicBasisMutable(),
+                                 adaptor.getDynamicBasis());
+  if (maybeStaticBasis) {
+    setStaticBasis(*maybeStaticBasis);
+    return getResult();
+  }
+  // setStaticBasis(foldCstValueToCstAttrBasis(
----------------
krzysz00 wrote:

Nit: commented code

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


More information about the Mlir-commits mailing list