[PATCH] D77083: [MLIR] Add pattern rewriter util to erase block; add affine.if pattern to remove dead else blocks
Uday Bondhugula via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 30 13:37:26 PDT 2020
bondhugula marked an inline comment as done.
bondhugula added inline comments.
================
Comment at: mlir/lib/IR/PatternMatch.cpp:94
+ for (auto &op : llvm::make_early_inc_range(*block)) {
+ assert(op.use_empty() && "expected 'op' to have no uses");
+ notifyOperationRemoved(&op);
----------------
rriddle wrote:
> bondhugula wrote:
> > rriddle wrote:
> > > This seems wrong, any non-trivially empty block will likely fail this check. Did you want to iterate the block in reverse?
> > Sorry, I didn't understand - what's a non-trivially empty block? AFAICT, the block is either empty of ops or it isn't.
> If you have something like:
>
> ^bb:
> %cst = constant 0 : i64
> foo.yield %cst : i64
>
> This will assert when trying to erase the block. Why should we assert that all ops have no uses?
It looks like I was looking at the wrong line / code context - fixed, thanks.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77083/new/
https://reviews.llvm.org/D77083
More information about the llvm-commits
mailing list