Skip to content

Commit f5fd8d0

Browse files
committed
[rebase] align Optimizer unit tests with llvm versions
1 parent 12df2c4 commit f5fd8d0

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

flang/include/flang/Optimizer/Support/InitFIR.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ namespace fir::support {
2727
#define FLANG_NONCODEGEN_DIALECT_LIST \
2828
mlir::AffineDialect, FIROpsDialect, mlir::acc::OpenACCDialect, \
2929
mlir::omp::OpenMPDialect, mlir::scf::SCFDialect, \
30-
mlir::StandardOpsDialect, mlir::vector::VectorDialect
30+
mlir::arith::ArithmeticDialect, mlir::StandardOpsDialect, \
31+
mlir::vector::VectorDialect
32+
3133

3234
// The definitive list of dialects used by flang.
3335
#define FLANG_DIALECT_LIST \

flang/unittests/Optimizer/Builder/DoLoopHelperTest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ struct DoLoopHelperTest : public testing::Test {
2929
};
3030

3131
void checkConstantValue(const mlir::Value &value, int64_t v) {
32-
EXPECT_TRUE(mlir::isa<ConstantOp>(value.getDefiningOp()));
33-
auto cstOp = dyn_cast<ConstantOp>(value.getDefiningOp());
34-
auto valueAttr = cstOp.getValue().dyn_cast_or_null<IntegerAttr>();
32+
EXPECT_TRUE(mlir::isa<mlir::arith::ConstantOp>(value.getDefiningOp()));
33+
auto cstOp = dyn_cast<mlir::arith::ConstantOp>(value.getDefiningOp());
34+
auto valueAttr = cstOp.value().dyn_cast_or_null<IntegerAttr>();
3535
EXPECT_EQ(v, valueAttr.getInt());
3636
}
3737

flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ static arith::CmpIOp createCondition(fir::FirOpBuilder &builder) {
4848
}
4949

5050
static void checkIntegerConstant(mlir::Value value, mlir::Type ty, int64_t v) {
51-
EXPECT_TRUE(mlir::isa<ConstantOp>(value.getDefiningOp()));
52-
auto cstOp = dyn_cast<ConstantOp>(value.getDefiningOp());
51+
EXPECT_TRUE(mlir::isa<mlir::arith::ConstantOp>(value.getDefiningOp()));
52+
auto cstOp = dyn_cast<mlir::arith::ConstantOp>(value.getDefiningOp());
5353
EXPECT_EQ(ty, cstOp.getType());
54-
auto valueAttr = cstOp.getValue().dyn_cast_or_null<IntegerAttr>();
54+
auto valueAttr = cstOp.value().dyn_cast_or_null<IntegerAttr>();
5555
EXPECT_EQ(v, valueAttr.getInt());
5656
}
5757

flang/unittests/Optimizer/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set(LIBS
99
)
1010

1111
add_flang_unittest(FlangOptimizerTests
12-
Builder/CharacterTest.cpp
12+
Builder/CharacterTest.cpp
1313
Builder/DoLoopHelperTest.cpp
1414
Builder/FIRBuilderTest.cpp
1515
FIRContextTest.cpp

flang/unittests/Optimizer/RTBuilder.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "flang/Optimizer/Builder/Runtime/RTBuilder.h"
1010
#include "flang/Optimizer/Support/InitFIR.h"
1111
#include "gtest/gtest.h"
12-
#include <complex>
1312

1413
// Check that it is possible to make a difference between complex runtime
1514
// function using C99 complex and C++ std::complex. This is important since
@@ -21,7 +20,9 @@
2120
c_float_complex_t c99_cacosf(c_float_complex_t);
2221

2322
TEST(RTBuilderTest, ComplexRuntimeInterface) {
24-
mlir::MLIRContext ctx;
23+
mlir::DialectRegistry registry;
24+
fir::support::registerDialects(registry);
25+
mlir::MLIRContext ctx(registry);
2526
fir::support::loadDialects(ctx);
2627
mlir::Type c99_cacosf_signature{
2728
fir::runtime::RuntimeTableKey<decltype(c99_cacosf)>::getTypeModel()(

0 commit comments

Comments
 (0)