Skip to content

Commit 2fe9a34

Browse files
committed
[mlir][SCF] Use getResult() instead of static_cast<Value>().
1 parent 0b3f6ff commit 2fe9a34

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

mlir/unittests/Dialect/SCF/LoopLikeSCFOpsTest.cpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,9 @@ TEST_F(SCFLoopLikeTest, queryUnidimensionalLooplikes) {
6868
checkUnidimensional(forOp.get());
6969

7070
OwningOpRef<scf::ForallOp> forallOp = b.create<scf::ForallOp>(
71-
loc, ArrayRef<OpFoldResult>(static_cast<Value>(lb.get())),
72-
ArrayRef<OpFoldResult>(static_cast<Value>(ub.get())),
73-
ArrayRef<OpFoldResult>(static_cast<Value>(step.get())), ValueRange(),
74-
std::nullopt);
71+
loc, ArrayRef<OpFoldResult>(lb->getResult()),
72+
ArrayRef<OpFoldResult>(ub->getResult()),
73+
ArrayRef<OpFoldResult>(step->getResult()), ValueRange(), std::nullopt);
7574
checkUnidimensional(forallOp.get());
7675

7776
OwningOpRef<scf::ParallelOp> parallelOp = b.create<scf::ParallelOp>(
@@ -87,19 +86,17 @@ TEST_F(SCFLoopLikeTest, queryMultidimensionalLooplikes) {
8786
b.create<arith::ConstantIndexOp>(loc, 10);
8887
OwningOpRef<arith::ConstantIndexOp> step =
8988
b.create<arith::ConstantIndexOp>(loc, 2);
90-
auto lbValue = static_cast<Value>(lb.get());
91-
auto ubValue = static_cast<Value>(ub.get());
92-
auto stepValue = static_cast<Value>(step.get());
9389

94-
OwningOpRef<scf::ForallOp> forallOp =
95-
b.create<scf::ForallOp>(loc, ArrayRef<OpFoldResult>({lbValue, lbValue}),
96-
ArrayRef<OpFoldResult>({ubValue, ubValue}),
97-
ArrayRef<OpFoldResult>({stepValue, stepValue}),
98-
ValueRange(), std::nullopt);
90+
OwningOpRef<scf::ForallOp> forallOp = b.create<scf::ForallOp>(
91+
loc, ArrayRef<OpFoldResult>({lb->getResult(), lb->getResult()}),
92+
ArrayRef<OpFoldResult>({ub->getResult(), ub->getResult()}),
93+
ArrayRef<OpFoldResult>({step->getResult(), step->getResult()}),
94+
ValueRange(), std::nullopt);
9995
checkMultidimensional(forallOp.get());
10096

10197
OwningOpRef<scf::ParallelOp> parallelOp = b.create<scf::ParallelOp>(
102-
loc, ValueRange({lbValue, lbValue}), ValueRange({ubValue, ubValue}),
103-
ValueRange({stepValue, stepValue}), ValueRange());
98+
loc, ValueRange({lb->getResult(), lb->getResult()}),
99+
ValueRange({ub->getResult(), ub->getResult()}),
100+
ValueRange({step->getResult(), step->getResult()}), ValueRange());
104101
checkMultidimensional(parallelOp.get());
105102
}

0 commit comments

Comments
 (0)