[mlir] Correct 2 places that result in corrupted conversion rollbacks

This corrects the last 2 issues caught by tests when causing dialect
conversion rollbacks to occur.

Differential Revision: https://reviews.llvm.org/D94623
This commit is contained in:
Tres Popp 2021-01-13 20:17:52 +01:00
parent 33a8466531
commit 3bd620d450
2 changed files with 2 additions and 1 deletions

View File

@ -2144,7 +2144,7 @@ Value mlir::LLVM::createGlobalString(Location loc, OpBuilder &builder,
assert(module && "builder points to an op outside of a module");
// Create the global at the entry of the module.
OpBuilder moduleBuilder(module.getBodyRegion());
OpBuilder moduleBuilder(module.getBodyRegion(), builder.getListener());
MLIRContext *ctx = builder.getContext();
auto type = LLVM::LLVMArrayType::get(IntegerType::get(ctx, 8), value.size());
auto global = moduleBuilder.create<LLVM::GlobalOp>(

View File

@ -849,6 +849,7 @@ static void detachNestedAndErase(Operation *op) {
block.dropAllDefinedValueUses();
}
}
op->dropAllUses();
op->erase();
}