[Mlir-commits] [mlir] f6fb639 - Fix memoery leak in MLIR use-def list ordering test

Mehdi Amini llvmlistbot at llvm.org
Sun May 21 20:22:53 PDT 2023


Author: Mehdi Amini
Date: 2023-05-21T20:11:30-07:00
New Revision: f6fb639c76ce255e2f5b3e2c8550270243e7e7ab

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

LOG: Fix memoery leak in MLIR use-def list ordering test

Added: 
    

Modified: 
    mlir/test/lib/IR/TestUseListOrders.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/test/lib/IR/TestUseListOrders.cpp b/mlir/test/lib/IR/TestUseListOrders.cpp
index 47300090d3d6..78c5a19db072 100644
--- a/mlir/test/lib/IR/TestUseListOrders.cpp
+++ b/mlir/test/lib/IR/TestUseListOrders.cpp
@@ -9,6 +9,7 @@
 #include "mlir/Bytecode/BytecodeWriter.h"
 #include "mlir/Bytecode/Encoding.h"
 #include "mlir/IR/BuiltinOps.h"
+#include "mlir/IR/OwningOpRef.h"
 #include "mlir/Parser/Parser.h"
 #include "mlir/Pass/Pass.h"
 
@@ -46,19 +47,19 @@ class TestPreserveUseListOrders
   void runOnOperation() override {
     // Clone the module so that we can plug in this pass to any other
     // independently.
-    auto cloneModule = getOperation().clone();
+    OwningOpRef<ModuleOp> cloneModule = getOperation().clone();
 
     // 1. Compute the op numbering of the module.
-    computeOpNumbering(cloneModule);
+    computeOpNumbering(*cloneModule);
 
     // 2. Loop over all the values and shuffle the uses. While doing so, check
     // that each shuffle is correct.
-    if (failed(shuffleUses(cloneModule)))
+    if (failed(shuffleUses(*cloneModule)))
       return signalPassFailure();
 
     // 3. Do a bytecode roundtrip to version 3, which supports use-list order
     // preservation.
-    auto roundtripModuleOr = doRoundtripToBytecode(cloneModule, 3);
+    auto roundtripModuleOr = doRoundtripToBytecode(*cloneModule, 3);
     // If the bytecode roundtrip failed, try to roundtrip the original module
     // to version 2, which does not support use-list. If this also fails, the
     // original module had an issue unrelated to uselists.


        


More information about the Mlir-commits mailing list