diff --git a/mlir/unittests/Conversion/PDLToPDLInterp/RootOrderingTest.cpp b/mlir/unittests/Conversion/PDLToPDLInterp/RootOrderingTest.cpp --- a/mlir/unittests/Conversion/PDLToPDLInterp/RootOrderingTest.cpp +++ b/mlir/unittests/Conversion/PDLToPDLInterp/RootOrderingTest.cpp @@ -7,12 +7,13 @@ //===----------------------------------------------------------------------===// #include "../lib/Conversion/PDLToPDLInterp/RootOrdering.h" -#include "mlir/Dialect/StandardOps/IR/Ops.h" +#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h" #include "mlir/IR/Builders.h" #include "mlir/IR/MLIRContext.h" #include "gtest/gtest.h" using namespace mlir; +using namespace mlir::arith; using namespace mlir::pdl_to_pdl_interp; namespace { @@ -29,16 +30,22 @@ class RootOrderingTest : public ::testing::Test { protected: RootOrderingTest() { - context.loadDialect(); + context.loadDialect(); createValues(); } + ~RootOrderingTest() { + for (unsigned i = 0; i < 4; ++i) { + assert(v[i] && v[i].getDefiningOp() && "empty value / defining op"); + v[i].getDefiningOp()->erase(); + } + } + /// Creates the test values. void createValues() { OpBuilder builder(&context); - for (int i = 0; i < 4; ++i) - v[i] = builder.create(builder.getUnknownLoc(), - builder.getI32IntegerAttr(i)); + for (unsigned i = 0; i < 4; ++i) + v[i] = builder.create(builder.getUnknownLoc(), i, 32); } /// Checks that optimal branching on graph has the given cost and