[Mlir-commits] [mlir] [mlir][unittest][nfc] Simplify `getInversePermutation` (PR #117698)
Javed Absar
llvmlistbot at llvm.org
Tue Nov 26 04:51:37 PST 2024
================
@@ -97,17 +97,12 @@ TEST(AffineMapTest, getInversePermutation) {
auto resultsInv1 = inverseMap1.getResults();
EXPECT_EQ(resultsInv1.size(), 3UL);
- // 1.1 Expect d2
- AffineDimExpr expr = llvm::dyn_cast<AffineDimExpr>(resultsInv1[0]);
- EXPECT_TRUE(expr && expr.getPosition() == 2);
-
- // 1.2 Expect d0
- expr = llvm::dyn_cast<AffineDimExpr>(resultsInv1[1]);
- EXPECT_TRUE(expr && expr.getPosition() == 0);
-
- // 1.3 Expect d3
- expr = llvm::dyn_cast<AffineDimExpr>(resultsInv1[2]);
- EXPECT_TRUE(expr && expr.getPosition() == 3);
+ // Expect (d2, d0, d3)
+ SmallVector<unsigned> expected = {2, 0, 3};
+ for (auto [idx, res] : llvm::enumerate(resultsInv1)) {
+ AffineDimExpr expr = llvm::dyn_cast<AffineDimExpr>(res);
+ EXPECT_TRUE(expr && expr.getPosition() == expected[idx]);
+ }
----------------
javedabsar1 wrote:
Beautiful.
https://github.com/llvm/llvm-project/pull/117698
More information about the Mlir-commits
mailing list