[Mlir-commits] [mlir] [MLIR][Operation] Fix `isBeforeInBlock` crash bug mentioned in https://github.com/llvm/llvm-project/issues/60909 (PR #101172)
Mehdi Amini
llvmlistbot at llvm.org
Thu Aug 1 05:18:08 PDT 2024
================
@@ -391,7 +391,7 @@ bool Operation::isBeforeInBlock(Operation *other) {
// parent.
if (!block->isOpOrderValid()) {
block->recomputeOpOrder();
- } else {
+ } else if (block->getOperations().size() > 1) {
----------------
joker-eph wrote:
That is costly, it's a linear scan.
However you could do:
```
if (!llvm::hasSingleElement(*block)) {
```
Should this be done in `updateOrderIfNecessary` though?
https://github.com/llvm/llvm-project/pull/101172
More information about the Mlir-commits
mailing list