[llvm-branch-commits] [mlir] 3bd620d - [mlir] Correct 2 places that result in corrupted conversion rollbacks

Tres Popp via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jan 13 11:35:34 PST 2021


Author: Tres Popp
Date: 2021-01-13T20:31:15+01:00
New Revision: 3bd620d4504915615b8368b20eb9e5c34f3fb779

URL: https://github.com/llvm/llvm-project/commit/3bd620d4504915615b8368b20eb9e5c34f3fb779
DIFF: https://github.com/llvm/llvm-project/commit/3bd620d4504915615b8368b20eb9e5c34f3fb779.diff

LOG: [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

Added: 
    

Modified: 
    mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    mlir/lib/Transforms/Utils/DialectConversion.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index b895c904d623..0e0d568c3440 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -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>(

diff  --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 33101a4102dd..f1fa1e250610 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -849,6 +849,7 @@ static void detachNestedAndErase(Operation *op) {
       block.dropAllDefinedValueUses();
     }
   }
+  op->dropAllUses();
   op->erase();
 }
 


        


More information about the llvm-branch-commits mailing list