[PATCH] D120057: [mlir][Affine] Fix -lower-affine -debug assertion
Cullen Rhodes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 17 07:07:54 PST 2022
c-rhodes created this revision.
c-rhodes added reviewers: bondhugula, ftynse, jsetoain.
Herald added subscribers: sdasgup3, Groverkss, wenzhicui, wrengr, Chia-hungDuan, dcaballe, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, antiagainst, shauheen, rriddle, mehdi_amini.
c-rhodes requested review of this revision.
Herald added a reviewer: nicolasvasilache.
Herald added subscribers: stephenneuendorffer, nicolasvasilache.
Herald added a project: MLIR.
The following:
mlir-opt -lower-affine -debug mlir/test/Conversion/AffineToStandard/lower-affine-to-vector.mlir
triggers an assertion:
affine.for mlir-opt:
mlir/include/mlir/IR/OpDefinition.h:839:
mlir::Block
*mlir::OpTrait::SingleBlock<mlir::AffineForOp>::getBody(unsigned int)
[ConcreteType = mlir::AffineFo
rOp]: Assertion `!region.empty() && "unexpected empty region"' failed.
Since the IR is in an invalid state after AffineForOp is lowered to
scf::ForOp in AffineForLowering.
Bail out in AffineForOp::print if the region is empty.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D120057
Files:
mlir/lib/Dialect/Affine/IR/AffineOps.cpp
Index: mlir/lib/Dialect/Affine/IR/AffineOps.cpp
===================================================================
--- mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -1550,6 +1550,12 @@
}
void AffineForOp::print(OpAsmPrinter &p) {
+ // Operation may be invalidated after applying a rewrite pattern.
+ if (region().empty()) {
+ p << " <NO REGION - INVALID>";
+ return;
+ }
+
p << ' ';
p.printOperand(getBody()->getArgument(0));
p << " = ";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120057.409641.patch
Type: text/x-patch
Size: 504 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220217/356e0ec8/attachment.bin>
More information about the llvm-commits
mailing list