[Mlir-commits] [mlir] 2fe9a34 - [mlir][SCF] Use getResult() instead of static_cast<Value>().

Adrian Kuegel llvmlistbot at llvm.org
Sun Oct 22 22:05:50 PDT 2023


Author: Adrian Kuegel
Date: 2023-10-23T05:05:28Z
New Revision: 2fe9a342a69d25636421b105d8c5e0cbbcce6a75

URL: https://github.com/llvm/llvm-project/commit/2fe9a342a69d25636421b105d8c5e0cbbcce6a75
DIFF: https://github.com/llvm/llvm-project/commit/2fe9a342a69d25636421b105d8c5e0cbbcce6a75.diff

LOG: [mlir][SCF] Use getResult() instead of static_cast<Value>().

Added: 
    

Modified: 
    mlir/unittests/Dialect/SCF/LoopLikeSCFOpsTest.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/unittests/Dialect/SCF/LoopLikeSCFOpsTest.cpp b/mlir/unittests/Dialect/SCF/LoopLikeSCFOpsTest.cpp
index a7694dcb45da8bf..6bc0fd6113b9bbf 100644
--- a/mlir/unittests/Dialect/SCF/LoopLikeSCFOpsTest.cpp
+++ b/mlir/unittests/Dialect/SCF/LoopLikeSCFOpsTest.cpp
@@ -68,10 +68,9 @@ TEST_F(SCFLoopLikeTest, queryUnidimensionalLooplikes) {
   checkUnidimensional(forOp.get());
 
   OwningOpRef<scf::ForallOp> forallOp = b.create<scf::ForallOp>(
-      loc, ArrayRef<OpFoldResult>(static_cast<Value>(lb.get())),
-      ArrayRef<OpFoldResult>(static_cast<Value>(ub.get())),
-      ArrayRef<OpFoldResult>(static_cast<Value>(step.get())), ValueRange(),
-      std::nullopt);
+      loc, ArrayRef<OpFoldResult>(lb->getResult()),
+      ArrayRef<OpFoldResult>(ub->getResult()),
+      ArrayRef<OpFoldResult>(step->getResult()), ValueRange(), std::nullopt);
   checkUnidimensional(forallOp.get());
 
   OwningOpRef<scf::ParallelOp> parallelOp = b.create<scf::ParallelOp>(
@@ -87,19 +86,17 @@ TEST_F(SCFLoopLikeTest, queryMultidimensionalLooplikes) {
       b.create<arith::ConstantIndexOp>(loc, 10);
   OwningOpRef<arith::ConstantIndexOp> step =
       b.create<arith::ConstantIndexOp>(loc, 2);
-  auto lbValue = static_cast<Value>(lb.get());
-  auto ubValue = static_cast<Value>(ub.get());
-  auto stepValue = static_cast<Value>(step.get());
 
-  OwningOpRef<scf::ForallOp> forallOp =
-      b.create<scf::ForallOp>(loc, ArrayRef<OpFoldResult>({lbValue, lbValue}),
-                              ArrayRef<OpFoldResult>({ubValue, ubValue}),
-                              ArrayRef<OpFoldResult>({stepValue, stepValue}),
-                              ValueRange(), std::nullopt);
+  OwningOpRef<scf::ForallOp> forallOp = b.create<scf::ForallOp>(
+      loc, ArrayRef<OpFoldResult>({lb->getResult(), lb->getResult()}),
+      ArrayRef<OpFoldResult>({ub->getResult(), ub->getResult()}),
+      ArrayRef<OpFoldResult>({step->getResult(), step->getResult()}),
+      ValueRange(), std::nullopt);
   checkMultidimensional(forallOp.get());
 
   OwningOpRef<scf::ParallelOp> parallelOp = b.create<scf::ParallelOp>(
-      loc, ValueRange({lbValue, lbValue}), ValueRange({ubValue, ubValue}),
-      ValueRange({stepValue, stepValue}), ValueRange());
+      loc, ValueRange({lb->getResult(), lb->getResult()}),
+      ValueRange({ub->getResult(), ub->getResult()}),
+      ValueRange({step->getResult(), step->getResult()}), ValueRange());
   checkMultidimensional(parallelOp.get());
 }


        


More information about the Mlir-commits mailing list