@@ -74,15 +74,15 @@ llvm::SmallBitVector MappingExpr::DependencyMask(int domain_size) const {
74
74
bool MappingExpr::HasNoneExprs () const {
75
75
bool has_none_exprs = false ;
76
76
Walk ([&](MappingExpr sub_expr) {
77
- has_none_exprs |= sub_expr. isa <MappingNoneExpr>();
77
+ has_none_exprs |= llvm:: isa<MappingNoneExpr>(sub_expr );
78
78
});
79
79
return has_none_exprs;
80
80
}
81
81
82
82
bool MappingExpr::HasUnknownExprs () const {
83
83
bool has_unknown_exprs = false ;
84
84
Walk ([&](MappingExpr sub_expr) {
85
- has_unknown_exprs |= sub_expr. isa <MappingUnknownExpr>();
85
+ has_unknown_exprs |= llvm:: isa<MappingUnknownExpr>(sub_expr );
86
86
});
87
87
return has_unknown_exprs;
88
88
}
@@ -109,10 +109,10 @@ int MappingExpr::MinDomainSize() const {
109
109
// expression is `?` or `none`. Returns `nullptr` if unification fails.
110
110
static MappingExpr ResolveNoneAndUnknownUnification (MappingExpr lhs,
111
111
MappingExpr rhs) {
112
- if (lhs. isa <MappingNoneExpr>()) return rhs;
113
- if (rhs. isa <MappingNoneExpr>()) return lhs;
114
- if (lhs. isa <MappingUnknownExpr>()) return rhs;
115
- if (rhs. isa <MappingUnknownExpr>()) return lhs;
112
+ if (llvm:: isa<MappingNoneExpr>(lhs )) return rhs;
113
+ if (llvm:: isa<MappingNoneExpr>(rhs )) return lhs;
114
+ if (llvm:: isa<MappingUnknownExpr>(lhs )) return rhs;
115
+ if (llvm:: isa<MappingUnknownExpr>(rhs )) return lhs;
116
116
return MappingExpr ();
117
117
}
118
118
@@ -383,7 +383,7 @@ mlir::LogicalResult MappingStripeExpr::SetInverse(
383
383
MappingExpr MappingStripeExpr::FindInInverse (
384
384
llvm::ArrayRef<MappingExpr> inverse) const {
385
385
auto operand_inverse = operand ().FindInInverse (inverse);
386
- if (operand_inverse. isa <MappingUnknownExpr, MappingNoneExpr>()) {
386
+ if (llvm:: isa<MappingUnknownExpr, MappingNoneExpr>(operand_inverse )) {
387
387
return operand_inverse;
388
388
}
389
389
auto unstripe_expr = llvm::cast<MappingUnStripeExpr>(operand_inverse);
@@ -545,7 +545,7 @@ MappingExpr MappingUnStripeExpr::Unify(
545
545
546
546
// If the last operand is `none` or `?`, we can replace it by an arbitrary
547
547
// number of operands.
548
- if (min_operands. back (). isa <MappingNoneExpr, MappingUnknownExpr>()) {
548
+ if (llvm:: isa<MappingNoneExpr, MappingUnknownExpr>(min_operands. back () )) {
549
549
min_operands = min_operands.drop_back ();
550
550
min_factors = min_factors.drop_back ();
551
551
}
@@ -568,7 +568,7 @@ MappingExpr MappingUnStripeExpr::FindInInverse(
568
568
MappingExpr operand_inverse;
569
569
for (int i = 0 , e = operands ().size (); i < e; ++i) {
570
570
operand_inverse = operands ()[i].FindInInverse (inverse);
571
- if (operand_inverse. isa <MappingUnknownExpr, MappingNoneExpr>()) continue ;
571
+ if (llvm:: isa<MappingUnknownExpr, MappingNoneExpr>(operand_inverse )) continue ;
572
572
return llvm::cast<MappingStripeExpr>(operand_inverse).operand ();
573
573
}
574
574
// Unstripe has at least one operand.
@@ -797,7 +797,7 @@ MappingAttr MappingAttr::MakeSurjective() const {
797
797
new_exprs.reserve (size ());
798
798
for (MappingExpr expr : Dimensions ()) {
799
799
MappingExpr new_expr = expr.Map ([&](MappingExpr sub_expr) -> MappingExpr {
800
- if (!sub_expr. isa <MappingNoneExpr>()) return sub_expr;
800
+ if (!llvm:: isa<MappingNoneExpr>(sub_expr )) return sub_expr;
801
801
return MappingDimExpr::get (num_dimensions++, getContext ());
802
802
});
803
803
new_exprs.push_back (new_expr);
@@ -810,7 +810,7 @@ MappingAttr MappingAttr::MakeFullySpecified() const {
810
810
auto new_exprs =
811
811
llvm::to_vector<4 >(llvm::map_range (Dimensions (), [&](auto expr) {
812
812
return expr.Map ([&](MappingExpr sub_expr) -> MappingExpr {
813
- return sub_expr. isa <MappingUnknownExpr>() ? none : sub_expr;
813
+ return llvm:: isa<MappingUnknownExpr>(sub_expr ) ? none : sub_expr;
814
814
});
815
815
}));
816
816
return MappingAttr::get (getContext (), UseDomainSize (), new_exprs);
@@ -946,8 +946,8 @@ MappingAttr MappingAttr::UnifyUnknownExprs(MappingAttr other) const {
946
946
for (auto [lhs, rhs] : llvm::zip (Dimensions (), other.Dimensions ())) {
947
947
MappingExpr unified =
948
948
lhs.Unify (rhs, [](MappingExpr sub_lhs, MappingExpr sub_rhs) {
949
- if (sub_lhs. isa <MappingUnknownExpr>()) return sub_rhs;
950
- if (sub_rhs. isa <MappingUnknownExpr>()) return sub_lhs;
949
+ if (llvm:: isa<MappingUnknownExpr>(sub_lhs )) return sub_rhs;
950
+ if (llvm:: isa<MappingUnknownExpr>(sub_rhs )) return sub_lhs;
951
951
return MappingExpr ();
952
952
});
953
953
if (unified == nullptr ) return nullptr ;
@@ -1236,7 +1236,7 @@ static DomainShapeDim StripeAccessedShape(MappingStripeExpr expr,
1236
1236
static DomainShapeDim UnStripeAccessedShape (MappingUnStripeExpr expr,
1237
1237
DomainShapeDim inner_shape,
1238
1238
MappingAttr inverted_mapping) {
1239
- if (inner_shape. type (). isa <DynRangeType>()) return inner_shape;
1239
+ if (llvm:: isa<DynRangeType>(inner_shape. type () )) return inner_shape;
1240
1240
auto type = llvm::cast<StaticRangeType>(inner_shape.type ());
1241
1241
int new_step = type.getStep () / expr.factors ().front ();
1242
1242
return DomainShapeDim (
@@ -1460,10 +1460,10 @@ bool LoopAttr::classof(mlir::Attribute attr) {
1460
1460
if (!derived) return false ;
1461
1461
1462
1462
auto name = derived.get (" name" );
1463
- if (!name. isa_and_nonnull <mlir::StringAttr>()) return false ;
1463
+ if (!llvm:: isa_and_nonnull<mlir::StringAttr>(name )) return false ;
1464
1464
1465
1465
auto iter = derived.get (" iter" );
1466
- if (!iter. isa_and_nonnull <sair::MappingExpr>()) return false ;
1466
+ if (!llvm:: isa_and_nonnull<sair::MappingExpr>(iter )) return false ;
1467
1467
1468
1468
auto unroll = derived.get (" unroll" );
1469
1469
if (!unroll) return derived.size () == 2 ;
@@ -1481,23 +1481,25 @@ mlir::StringAttr LoopAttr::name() const {
1481
1481
auto derived = llvm::cast<mlir::DictionaryAttr>(*this );
1482
1482
auto name = derived.get (" name" );
1483
1483
assert (name && " attribute not found." );
1484
- assert (name.isa <mlir::StringAttr>() && " incorrect Attribute type found." );
1484
+ assert (llvm::isa<mlir::StringAttr>(name) &&
1485
+ " incorrect Attribute type found." );
1485
1486
return llvm::cast<mlir::StringAttr>(name);
1486
1487
}
1487
1488
1488
1489
MappingExpr LoopAttr::iter () const {
1489
1490
auto derived = llvm::cast<mlir::DictionaryAttr>(*this );
1490
1491
auto iter = derived.get (" iter" );
1491
1492
assert (iter && " attribute not found." );
1492
- assert (iter. isa <MappingExpr>() && " incorrect Attribute type found." );
1493
+ assert (llvm:: isa<MappingExpr>(iter ) && " incorrect Attribute type found." );
1493
1494
return llvm::cast<MappingExpr>(iter);
1494
1495
}
1495
1496
1496
1497
mlir::IntegerAttr LoopAttr::unroll () const {
1497
1498
auto derived = llvm::cast<mlir::DictionaryAttr>(*this );
1498
1499
auto unroll = derived.get (" unroll" );
1499
1500
if (!unroll) return nullptr ;
1500
- assert (unroll.isa <mlir::IntegerAttr>() && " incorrect Attribute type found." );
1501
+ assert (llvm::isa<mlir::IntegerAttr>(unroll) &&
1502
+ " incorrect Attribute type found." );
1501
1503
return llvm::cast<mlir::IntegerAttr>(unroll);
1502
1504
}
1503
1505
@@ -1531,19 +1533,19 @@ bool BufferAttr::classof(mlir::Attribute attr) {
1531
1533
int num_absent_attrs = 0 ;
1532
1534
1533
1535
auto space = derived.get (" space" );
1534
- if (!space. isa_and_nonnull <mlir::StringAttr>()) return false ;
1536
+ if (!llvm:: isa_and_nonnull<mlir::StringAttr>(space )) return false ;
1535
1537
1536
1538
auto name = derived.get (" name" );
1537
1539
if (!name) {
1538
1540
++num_absent_attrs;
1539
- } else if (!name. isa <mlir::StringAttr>()) {
1541
+ } else if (!llvm:: isa<mlir::StringAttr>(name )) {
1540
1542
return false ;
1541
1543
}
1542
1544
1543
1545
auto layout = derived.get (" layout" );
1544
1546
if (!layout) {
1545
1547
++num_absent_attrs;
1546
- } else if (!layout. isa <NamedMappingAttr>()) {
1548
+ } else if (!llvm:: isa<NamedMappingAttr>(layout )) {
1547
1549
return false ;
1548
1550
}
1549
1551
@@ -1554,23 +1556,25 @@ mlir::StringAttr BufferAttr::space() const {
1554
1556
auto derived = llvm::cast<mlir::DictionaryAttr>(*this );
1555
1557
auto space = derived.get (" space" );
1556
1558
assert (space && " attribute not found." );
1557
- assert (space. isa <mlir::StringAttr>() && " incorrect Attribute type found." );
1559
+ assert (llvm:: isa<mlir::StringAttr>(space ) && " incorrect Attribute type found." );
1558
1560
return llvm::cast<mlir::StringAttr>(space);
1559
1561
}
1560
1562
1561
1563
mlir::StringAttr BufferAttr::name () const {
1562
1564
auto derived = llvm::cast<mlir::DictionaryAttr>(*this );
1563
1565
auto name = derived.get (" name" );
1564
1566
if (!name) return nullptr ;
1565
- assert (name.isa <mlir::StringAttr>() && " incorrect Attribute type found." );
1567
+ assert (llvm::isa<mlir::StringAttr>(name) &&
1568
+ " incorrect Attribute type found." );
1566
1569
return llvm::cast<mlir::StringAttr>(name);
1567
1570
}
1568
1571
1569
1572
NamedMappingAttr BufferAttr::layout () const {
1570
1573
auto derived = llvm::cast<mlir::DictionaryAttr>(*this );
1571
1574
auto layout = derived.get (" layout" );
1572
1575
if (!layout) return nullptr ;
1573
- assert (layout.isa <NamedMappingAttr>() && " incorrect Attribute type found." );
1576
+ assert (llvm::isa<NamedMappingAttr>(layout) &&
1577
+ " incorrect Attribute type found." );
1574
1578
return llvm::cast<NamedMappingAttr>(layout);
1575
1579
}
1576
1580
@@ -1640,7 +1644,7 @@ bool DecisionsAttr::classof(mlir::Attribute attr) {
1640
1644
auto loop_nest_attr = llvm::dyn_cast<mlir::ArrayAttr>(loop_nest);
1641
1645
if (!loop_nest_attr) return false ;
1642
1646
if (llvm::any_of (loop_nest_attr, [](mlir::Attribute attr) {
1643
- return !attr. isa_and_nonnull <LoopAttr>();
1647
+ return !llvm:: isa_and_nonnull<LoopAttr>(attr );
1644
1648
})) {
1645
1649
return false ;
1646
1650
}
@@ -1649,21 +1653,21 @@ bool DecisionsAttr::classof(mlir::Attribute attr) {
1649
1653
auto storage = derived.get (" storage" );
1650
1654
if (!storage) {
1651
1655
++num_absent_attrs;
1652
- } else if (!storage. isa <mlir::ArrayAttr>()) {
1656
+ } else if (!llvm:: isa<mlir::ArrayAttr>(storage )) {
1653
1657
return false ;
1654
1658
}
1655
1659
1656
1660
auto expansion = derived.get (" expansion" );
1657
1661
if (!expansion) {
1658
1662
++num_absent_attrs;
1659
- } else if (!expansion. isa <mlir::StringAttr>()) {
1663
+ } else if (!llvm:: isa<mlir::StringAttr>(expansion )) {
1660
1664
return false ;
1661
1665
}
1662
1666
1663
1667
auto copy_of = derived.get (" copy_of" );
1664
1668
if (!copy_of) {
1665
1669
++num_absent_attrs;
1666
- } else if (!copy_of. isa <CopyAttr, InstanceAttr, mlir::UnitAttr>()) {
1670
+ } else if (!llvm:: isa<CopyAttr, InstanceAttr, mlir::UnitAttr>(copy_of )) {
1667
1671
return false ;
1668
1672
}
1669
1673
@@ -1673,8 +1677,8 @@ bool DecisionsAttr::classof(mlir::Attribute attr) {
1673
1677
} else {
1674
1678
auto operands_attr = llvm::dyn_cast<mlir::ArrayAttr>(operands);
1675
1679
if (llvm::any_of (operands_attr, [](mlir::Attribute attr) {
1676
- return !attr. isa_and_nonnull <CopyAttr, InstanceAttr,
1677
- mlir::UnitAttr>( );
1680
+ return !llvm:: isa_and_nonnull<CopyAttr, InstanceAttr, mlir::UnitAttr>(
1681
+ attr );
1678
1682
})) {
1679
1683
return false ;
1680
1684
}
@@ -1687,7 +1691,7 @@ mlir::IntegerAttr DecisionsAttr::sequence() const {
1687
1691
auto derived = llvm::cast<mlir::DictionaryAttr>(*this );
1688
1692
auto sequence = derived.get (" sequence" );
1689
1693
if (!sequence) return nullptr ;
1690
- assert (sequence. isa <mlir::IntegerAttr>() &&
1694
+ assert (llvm:: isa<mlir::IntegerAttr>(sequence ) &&
1691
1695
" incorrect Attribute type found." );
1692
1696
return llvm::cast<mlir::IntegerAttr>(sequence);
1693
1697
}
@@ -1696,23 +1700,25 @@ mlir::ArrayAttr DecisionsAttr::loop_nest() const {
1696
1700
auto derived = llvm::cast<mlir::DictionaryAttr>(*this );
1697
1701
auto loop_nest = derived.get (" loop_nest" );
1698
1702
if (!loop_nest) return nullptr ;
1699
- assert (loop_nest.isa <mlir::ArrayAttr>() && " incorrect Attribute type found." );
1703
+ assert (llvm::isa<mlir::ArrayAttr>(loop_nest) &&
1704
+ " incorrect Attribute type found." );
1700
1705
return llvm::cast<mlir::ArrayAttr>(loop_nest);
1701
1706
}
1702
1707
1703
1708
mlir::ArrayAttr DecisionsAttr::storage () const {
1704
1709
auto derived = llvm::cast<mlir::DictionaryAttr>(*this );
1705
1710
auto storage = derived.get (" storage" );
1706
1711
if (!storage) return nullptr ;
1707
- assert (storage.isa <mlir::ArrayAttr>() && " incorrect Attribute type found." );
1712
+ assert (llvm::isa<mlir::ArrayAttr>(storage) &&
1713
+ " incorrect Attribute type found." );
1708
1714
return llvm::cast<mlir::ArrayAttr>(storage);
1709
1715
}
1710
1716
1711
1717
mlir::StringAttr DecisionsAttr::expansion () const {
1712
1718
auto derived = llvm::cast<mlir::DictionaryAttr>(*this );
1713
1719
auto expansion = derived.get (" expansion" );
1714
1720
if (!expansion) return nullptr ;
1715
- assert (expansion. isa <mlir::StringAttr>() &&
1721
+ assert (llvm:: isa<mlir::StringAttr>(expansion ) &&
1716
1722
" incorrect Attribute type found." );
1717
1723
return llvm::cast<mlir::StringAttr>(expansion);
1718
1724
}
@@ -1721,15 +1727,17 @@ mlir::Attribute DecisionsAttr::copy_of() const {
1721
1727
auto derived = llvm::cast<mlir::DictionaryAttr>(*this );
1722
1728
auto copy_of = derived.get (" copy_of" );
1723
1729
if (!copy_of) return nullptr ;
1724
- assert (copy_of.isa <mlir::Attribute>() && " incorrect Attribute type found." );
1730
+ assert (llvm::isa<mlir::Attribute>(copy_of) &&
1731
+ " incorrect Attribute type found." );
1725
1732
return llvm::cast<mlir::Attribute>(copy_of);
1726
1733
}
1727
1734
1728
1735
mlir::ArrayAttr DecisionsAttr::operands () const {
1729
1736
auto derived = llvm::cast<mlir::DictionaryAttr>(*this );
1730
1737
auto operands = derived.get (" operands" );
1731
1738
if (!operands) return nullptr ;
1732
- assert (operands.isa <mlir::ArrayAttr>() && " incorrect Attribute type found." );
1739
+ assert (llvm::isa<mlir::ArrayAttr>(operands) &&
1740
+ " incorrect Attribute type found." );
1733
1741
return llvm::cast<mlir::ArrayAttr>(operands);
1734
1742
}
1735
1743
0 commit comments