@@ -1631,9 +1631,9 @@ class CopySimplification final : public OpRewritePattern<T> {
1631
1631
Type elTy = dstTy.getElementType ();
1632
1632
1633
1633
size_t width = 1 ;
1634
- if (auto IT = elTy. dyn_cast <IntegerType>())
1634
+ if (auto IT = dyn_cast<IntegerType>(elTy ))
1635
1635
width = IT.getWidth () / 8 ;
1636
- else if (auto FT = elTy. dyn_cast <FloatType>())
1636
+ else if (auto FT = dyn_cast<FloatType>(elTy ))
1637
1637
width = FT.getWidth () / 8 ;
1638
1638
else {
1639
1639
// TODO extend to llvm compatible type
@@ -1734,9 +1734,9 @@ class SetSimplification final : public OpRewritePattern<T> {
1734
1734
return failure ();
1735
1735
1736
1736
size_t width = 1 ;
1737
- if (auto IT = elTy. dyn_cast <IntegerType>())
1737
+ if (auto IT = dyn_cast<IntegerType>(elTy ))
1738
1738
width = IT.getWidth () / 8 ;
1739
- else if (auto FT = elTy. dyn_cast <FloatType>())
1739
+ else if (auto FT = dyn_cast<FloatType>(elTy ))
1740
1740
width = FT.getWidth () / 8 ;
1741
1741
else {
1742
1742
// TODO extend to llvm compatible type
@@ -1787,7 +1787,7 @@ class SetSimplification final : public OpRewritePattern<T> {
1787
1787
SmallVector<Value> idxs;
1788
1788
Value val;
1789
1789
1790
- if (auto IT = elTy. dyn_cast <IntegerType>())
1790
+ if (auto IT = dyn_cast<IntegerType>(elTy ))
1791
1791
val =
1792
1792
rewriter.create <arith::ConstantIntOp>(op.getLoc (), 0 , IT.getWidth ());
1793
1793
else {
@@ -2479,7 +2479,7 @@ class SelectOfExt final : public OpRewritePattern<arith::SelectOp> {
2479
2479
2480
2480
LogicalResult matchAndRewrite (arith::SelectOp op,
2481
2481
PatternRewriter &rewriter) const override {
2482
- auto ty = op. getType (). dyn_cast <IntegerType>();
2482
+ auto ty = dyn_cast<IntegerType>(op. getType () );
2483
2483
if (!ty)
2484
2484
return failure ();
2485
2485
IntegerAttr lhs, rhs;
@@ -2589,10 +2589,10 @@ class CmpProp final : public OpRewritePattern<CmpIOp> {
2589
2589
v.getDefiningOp <LLVM::UndefOp>() ||
2590
2590
v.getDefiningOp <polygeist::UndefOp>();
2591
2591
if (auto extOp = v.getDefiningOp <ExtUIOp>())
2592
- if (auto it = extOp.getIn ().getType (). dyn_cast <IntegerType>( ))
2592
+ if (auto it = dyn_cast<IntegerType>( extOp.getIn ().getType ()))
2593
2593
change |= it.getWidth () == 1 ;
2594
2594
if (auto extOp = v.getDefiningOp <ExtSIOp>())
2595
- if (auto it = extOp.getIn ().getType (). dyn_cast <IntegerType>( ))
2595
+ if (auto it = dyn_cast<IntegerType>( extOp.getIn ().getType ()))
2596
2596
change |= it.getWidth () == 1 ;
2597
2597
}
2598
2598
if (!change) {
@@ -3175,7 +3175,7 @@ bool valueCmp(Cmp cmp, Value bval, ValueOrInt val) {
3175
3175
}
3176
3176
}
3177
3177
3178
- if (auto baval = bval. dyn_cast <BlockArgument>()) {
3178
+ if (auto baval = dyn_cast<BlockArgument>(bval )) {
3179
3179
if (affine::AffineForOp afFor =
3180
3180
dyn_cast<affine::AffineForOp>(baval.getOwner ()->getParentOp ())) {
3181
3181
auto for_lb = afFor.getLowerBoundMap ().getResults ()[baval.getArgNumber ()];
@@ -3487,7 +3487,7 @@ bool valueCmp(Cmp cmp, AffineExpr expr, size_t numDim, ValueRange operands,
3487
3487
3488
3488
// Range is [lb, ub)
3489
3489
bool rangeIncludes (Value bval, ValueOrInt lb, ValueOrInt ub) {
3490
- if (auto baval = bval. dyn_cast <BlockArgument>()) {
3490
+ if (auto baval = dyn_cast<BlockArgument>(bval )) {
3491
3491
if (affine::AffineForOp afFor =
3492
3492
dyn_cast<affine::AffineForOp>(baval.getOwner ()->getParentOp ())) {
3493
3493
return valueCmp (
@@ -3621,7 +3621,7 @@ struct AffineIfSinking : public OpRewritePattern<affine::AffineIfOp> {
3621
3621
if (!opd) {
3622
3622
return failure ();
3623
3623
}
3624
- auto ival = op.getOperands ()[opd.getPosition ()]. dyn_cast <BlockArgument>( );
3624
+ auto ival = dyn_cast<BlockArgument>( op.getOperands ()[opd.getPosition ()]);
3625
3625
if (!ival) {
3626
3626
return failure ();
3627
3627
}
@@ -3663,7 +3663,7 @@ struct AffineIfSinking : public OpRewritePattern<affine::AffineIfOp> {
3663
3663
if (!par.getRegion ().isAncestor (v.getParentRegion ()) ||
3664
3664
op.getThenRegion ().isAncestor (v.getParentRegion ()))
3665
3665
return ;
3666
- if (auto ba = v. dyn_cast <BlockArgument>()) {
3666
+ if (auto ba = dyn_cast<BlockArgument>(v )) {
3667
3667
if (ba.getOwner ()->getParentOp () == par) {
3668
3668
return ;
3669
3669
}
@@ -4285,7 +4285,7 @@ struct MergeNestedAffineParallelIf
4285
4285
continue ;
4286
4286
}
4287
4287
if (auto dim = cur.dyn_cast <AffineDimExpr>()) {
4288
- auto ival = operands[dim.getPosition ()]. dyn_cast <BlockArgument>( );
4288
+ auto ival = dyn_cast<BlockArgument>( operands[dim.getPosition ()]);
4289
4289
if (!ival || ival.getOwner ()->getParentOp () != op) {
4290
4290
rhs = rhs + dim;
4291
4291
if (failure)
@@ -4315,7 +4315,7 @@ struct MergeNestedAffineParallelIf
4315
4315
4316
4316
if (auto dim = bop.getLHS ().dyn_cast <AffineDimExpr>()) {
4317
4317
auto ival =
4318
- operands[dim.getPosition ()]. dyn_cast <BlockArgument>( );
4318
+ dyn_cast<BlockArgument>( operands[dim.getPosition ()]);
4319
4319
if (!ival || ival.getOwner ()->getParentOp () != op) {
4320
4320
rhs = rhs + bop;
4321
4321
// While legal, this may run before parallel merging
@@ -4511,7 +4511,7 @@ struct MergeParallelInductions
4511
4511
continue ;
4512
4512
}
4513
4513
if (auto dim = cur.dyn_cast <AffineDimExpr>()) {
4514
- auto ival = operands[dim.getPosition ()]. dyn_cast <BlockArgument>( );
4514
+ auto ival = dyn_cast<BlockArgument>( operands[dim.getPosition ()]);
4515
4515
if (!ival || ival.getOwner ()->getParentOp () != op) {
4516
4516
rhs = rhs + dim;
4517
4517
continue ;
@@ -4538,7 +4538,7 @@ struct MergeParallelInductions
4538
4538
}
4539
4539
4540
4540
if (auto dim = bop.getLHS ().dyn_cast <AffineDimExpr>()) {
4541
- auto ival = operands[dim.getPosition ()]. dyn_cast <BlockArgument>( );
4541
+ auto ival = dyn_cast<BlockArgument>( operands[dim.getPosition ()]);
4542
4542
if (!ival || ival.getOwner ()->getParentOp () != op) {
4543
4543
rhs = rhs + bop;
4544
4544
continue ;
@@ -4983,8 +4983,8 @@ template <typename T> struct BufferElimination : public OpRewritePattern<T> {
4983
4983
auto opd = map.getResults ()[0 ].dyn_cast <AffineDimExpr>();
4984
4984
if (!opd)
4985
4985
continue ;
4986
- auto val = ((Value)load. getMapOperands ()[opd. getPosition ()])
4987
- . dyn_cast <BlockArgument>( );
4986
+ auto val = dyn_cast<BlockArgument>(
4987
+ ((Value)load. getMapOperands ()[opd. getPosition ()]) );
4988
4988
if (!val)
4989
4989
continue ;
4990
4990
@@ -5033,8 +5033,8 @@ template <typename T> struct BufferElimination : public OpRewritePattern<T> {
5033
5033
auto opd = map.getResults ()[0 ].dyn_cast <AffineDimExpr>();
5034
5034
if (!opd)
5035
5035
continue ;
5036
- auto val = ((Value)load. getMapOperands ()[opd. getPosition ()])
5037
- . dyn_cast <BlockArgument>( );
5036
+ auto val = dyn_cast<BlockArgument>(
5037
+ ((Value)load. getMapOperands ()[opd. getPosition ()]) );
5038
5038
if (!val)
5039
5039
continue ;
5040
5040
@@ -5279,7 +5279,7 @@ struct AffineBufferElimination : public OpRewritePattern<T> {
5279
5279
}
5280
5280
if (storeIdxs[pair.index ()].isValue ) {
5281
5281
Value auval = storeIdxs[pair.index ()].v_val ;
5282
- BlockArgument bval = auval. dyn_cast <BlockArgument>();
5282
+ BlockArgument bval = dyn_cast<BlockArgument>(auval );
5283
5283
if (!bval) {
5284
5284
LLVM_DEBUG (llvm::dbgs () << " + non bval expr " << bval << " \n " );
5285
5285
continue ;
@@ -5339,7 +5339,7 @@ struct AffineBufferElimination : public OpRewritePattern<T> {
5339
5339
if (!VI.isValue )
5340
5340
continue ;
5341
5341
auto V = VI.v_val ;
5342
- auto BA = V. dyn_cast <BlockArgument>();
5342
+ auto BA = dyn_cast<BlockArgument>(V );
5343
5343
if (!BA) {
5344
5344
LLVM_DEBUG (llvm::dbgs () << " + non map oper " << V << " \n " );
5345
5345
return failure ();
@@ -5426,7 +5426,7 @@ struct AffineBufferElimination : public OpRewritePattern<T> {
5426
5426
if (!VI.isValue )
5427
5427
continue ;
5428
5428
auto V = VI.v_val ;
5429
- auto BA = V. dyn_cast <BlockArgument>();
5429
+ auto BA = dyn_cast<BlockArgument>(V );
5430
5430
Operation *c = BA.getOwner ()->getParentOp ();
5431
5431
if (isa<affine::AffineParallelOp>(c) || isa<scf::ParallelOp>(c)) {
5432
5432
Operation *tmp = store;
@@ -5468,7 +5468,7 @@ struct AffineBufferElimination : public OpRewritePattern<T> {
5468
5468
if (storeIdxSet.count (V))
5469
5469
continue ;
5470
5470
5471
- if (auto BA = V. dyn_cast <BlockArgument>()) {
5471
+ if (auto BA = dyn_cast<BlockArgument>(V )) {
5472
5472
Operation *parent = BA.getOwner ()->getParentOp ();
5473
5473
5474
5474
if (auto sop = storeVal.getDefiningOp ())
@@ -5518,10 +5518,10 @@ struct AffineBufferElimination : public OpRewritePattern<T> {
5518
5518
if (!isa<MemoryEffects::Read>(res.getEffect ()))
5519
5519
return false ;
5520
5520
unsigned addr = 0 ;
5521
- if (auto MT = v. getType (). dyn_cast <MemRefType>())
5521
+ if (auto MT = dyn_cast<MemRefType>(v. getType () ))
5522
5522
addr = MT.getMemorySpaceAsInt ();
5523
5523
else if (auto LT =
5524
- v. getType (). dyn_cast <LLVM::LLVMPointerType>())
5524
+ dyn_cast<LLVM::LLVMPointerType>(v. getType () ))
5525
5525
addr = LT.getAddressSpace ();
5526
5526
else
5527
5527
return false ;
0 commit comments