Skip to content

Commit f6fb639

Browse files
committed
Fix memoery leak in MLIR use-def list ordering test
1 parent 5ba10ad commit f6fb639

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

mlir/test/lib/IR/TestUseListOrders.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "mlir/Bytecode/BytecodeWriter.h"
1010
#include "mlir/Bytecode/Encoding.h"
1111
#include "mlir/IR/BuiltinOps.h"
12+
#include "mlir/IR/OwningOpRef.h"
1213
#include "mlir/Parser/Parser.h"
1314
#include "mlir/Pass/Pass.h"
1415

@@ -46,19 +47,19 @@ class TestPreserveUseListOrders
4647
void runOnOperation() override {
4748
// Clone the module so that we can plug in this pass to any other
4849
// independently.
49-
auto cloneModule = getOperation().clone();
50+
OwningOpRef<ModuleOp> cloneModule = getOperation().clone();
5051

5152
// 1. Compute the op numbering of the module.
52-
computeOpNumbering(cloneModule);
53+
computeOpNumbering(*cloneModule);
5354

5455
// 2. Loop over all the values and shuffle the uses. While doing so, check
5556
// that each shuffle is correct.
56-
if (failed(shuffleUses(cloneModule)))
57+
if (failed(shuffleUses(*cloneModule)))
5758
return signalPassFailure();
5859

5960
// 3. Do a bytecode roundtrip to version 3, which supports use-list order
6061
// preservation.
61-
auto roundtripModuleOr = doRoundtripToBytecode(cloneModule, 3);
62+
auto roundtripModuleOr = doRoundtripToBytecode(*cloneModule, 3);
6263
// If the bytecode roundtrip failed, try to roundtrip the original module
6364
// to version 2, which does not support use-list. If this also fails, the
6465
// original module had an issue unrelated to uselists.

0 commit comments

Comments
 (0)