summaryrefslogtreecommitdiff
path: root/mlir/test/lib/IR/TestUseListOrders.cpp
diff options
context:
space:
mode:
authorMehdi Amini <joker.eph@gmail.com>2023-05-21 20:11:30 -0700
committerMehdi Amini <joker.eph@gmail.com>2023-05-21 20:11:30 -0700
commitf6fb639c76ce255e2f5b3e2c8550270243e7e7ab (patch)
treeffc067c7c7c67382c6047954bdbcdc2963e32b9a /mlir/test/lib/IR/TestUseListOrders.cpp
parent5ba10ad9dc43a0c5dc2883ae6fac64307f689820 (diff)
Fix memoery leak in MLIR use-def list ordering test
Diffstat (limited to 'mlir/test/lib/IR/TestUseListOrders.cpp')
-rw-r--r--mlir/test/lib/IR/TestUseListOrders.cpp9
1 files changed, 5 insertions, 4 deletions
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 @@ public:
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.