@@ -1631,9 +1631,9 @@ class CopySimplification final : public OpRewritePattern<T> {
16311631 Type elTy = dstTy.getElementType ();
16321632
16331633 size_t width = 1 ;
1634- if (auto IT = elTy. dyn_cast <IntegerType>())
1634+ if (auto IT = dyn_cast<IntegerType>(elTy ))
16351635 width = IT.getWidth () / 8 ;
1636- else if (auto FT = elTy. dyn_cast <FloatType>())
1636+ else if (auto FT = dyn_cast<FloatType>(elTy ))
16371637 width = FT.getWidth () / 8 ;
16381638 else {
16391639 // TODO extend to llvm compatible type
@@ -1734,9 +1734,9 @@ class SetSimplification final : public OpRewritePattern<T> {
17341734 return failure ();
17351735
17361736 size_t width = 1 ;
1737- if (auto IT = elTy. dyn_cast <IntegerType>())
1737+ if (auto IT = dyn_cast<IntegerType>(elTy ))
17381738 width = IT.getWidth () / 8 ;
1739- else if (auto FT = elTy. dyn_cast <FloatType>())
1739+ else if (auto FT = dyn_cast<FloatType>(elTy ))
17401740 width = FT.getWidth () / 8 ;
17411741 else {
17421742 // TODO extend to llvm compatible type
@@ -1787,7 +1787,7 @@ class SetSimplification final : public OpRewritePattern<T> {
17871787 SmallVector<Value> idxs;
17881788 Value val;
17891789
1790- if (auto IT = elTy. dyn_cast <IntegerType>())
1790+ if (auto IT = dyn_cast<IntegerType>(elTy ))
17911791 val =
17921792 rewriter.create <arith::ConstantIntOp>(op.getLoc (), 0 , IT.getWidth ());
17931793 else {
@@ -2479,7 +2479,7 @@ class SelectOfExt final : public OpRewritePattern<arith::SelectOp> {
24792479
24802480 LogicalResult matchAndRewrite (arith::SelectOp op,
24812481 PatternRewriter &rewriter) const override {
2482- auto ty = op. getType (). dyn_cast <IntegerType>();
2482+ auto ty = dyn_cast<IntegerType>(op. getType () );
24832483 if (!ty)
24842484 return failure ();
24852485 IntegerAttr lhs, rhs;
@@ -2589,10 +2589,10 @@ class CmpProp final : public OpRewritePattern<CmpIOp> {
25892589 v.getDefiningOp <LLVM::UndefOp>() ||
25902590 v.getDefiningOp <polygeist::UndefOp>();
25912591 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 ()))
25932593 change |= it.getWidth () == 1 ;
25942594 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 ()))
25962596 change |= it.getWidth () == 1 ;
25972597 }
25982598 if (!change) {
@@ -3175,7 +3175,7 @@ bool valueCmp(Cmp cmp, Value bval, ValueOrInt val) {
31753175 }
31763176 }
31773177
3178- if (auto baval = bval. dyn_cast <BlockArgument>()) {
3178+ if (auto baval = dyn_cast<BlockArgument>(bval )) {
31793179 if (affine::AffineForOp afFor =
31803180 dyn_cast<affine::AffineForOp>(baval.getOwner ()->getParentOp ())) {
31813181 auto for_lb = afFor.getLowerBoundMap ().getResults ()[baval.getArgNumber ()];
@@ -3487,7 +3487,7 @@ bool valueCmp(Cmp cmp, AffineExpr expr, size_t numDim, ValueRange operands,
34873487
34883488// Range is [lb, ub)
34893489bool rangeIncludes (Value bval, ValueOrInt lb, ValueOrInt ub) {
3490- if (auto baval = bval. dyn_cast <BlockArgument>()) {
3490+ if (auto baval = dyn_cast<BlockArgument>(bval )) {
34913491 if (affine::AffineForOp afFor =
34923492 dyn_cast<affine::AffineForOp>(baval.getOwner ()->getParentOp ())) {
34933493 return valueCmp (
@@ -3621,7 +3621,7 @@ struct AffineIfSinking : public OpRewritePattern<affine::AffineIfOp> {
36213621 if (!opd) {
36223622 return failure ();
36233623 }
3624- auto ival = op.getOperands ()[opd.getPosition ()]. dyn_cast <BlockArgument>( );
3624+ auto ival = dyn_cast<BlockArgument>( op.getOperands ()[opd.getPosition ()]);
36253625 if (!ival) {
36263626 return failure ();
36273627 }
@@ -3663,7 +3663,7 @@ struct AffineIfSinking : public OpRewritePattern<affine::AffineIfOp> {
36633663 if (!par.getRegion ().isAncestor (v.getParentRegion ()) ||
36643664 op.getThenRegion ().isAncestor (v.getParentRegion ()))
36653665 return ;
3666- if (auto ba = v. dyn_cast <BlockArgument>()) {
3666+ if (auto ba = dyn_cast<BlockArgument>(v )) {
36673667 if (ba.getOwner ()->getParentOp () == par) {
36683668 return ;
36693669 }
@@ -4285,7 +4285,7 @@ struct MergeNestedAffineParallelIf
42854285 continue ;
42864286 }
42874287 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 ()]);
42894289 if (!ival || ival.getOwner ()->getParentOp () != op) {
42904290 rhs = rhs + dim;
42914291 if (failure)
@@ -4315,7 +4315,7 @@ struct MergeNestedAffineParallelIf
43154315
43164316 if (auto dim = bop.getLHS ().dyn_cast <AffineDimExpr>()) {
43174317 auto ival =
4318- operands[dim.getPosition ()]. dyn_cast <BlockArgument>( );
4318+ dyn_cast<BlockArgument>( operands[dim.getPosition ()]);
43194319 if (!ival || ival.getOwner ()->getParentOp () != op) {
43204320 rhs = rhs + bop;
43214321 // While legal, this may run before parallel merging
@@ -4511,7 +4511,7 @@ struct MergeParallelInductions
45114511 continue ;
45124512 }
45134513 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 ()]);
45154515 if (!ival || ival.getOwner ()->getParentOp () != op) {
45164516 rhs = rhs + dim;
45174517 continue ;
@@ -4538,7 +4538,7 @@ struct MergeParallelInductions
45384538 }
45394539
45404540 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 ()]);
45424542 if (!ival || ival.getOwner ()->getParentOp () != op) {
45434543 rhs = rhs + bop;
45444544 continue ;
@@ -4983,8 +4983,8 @@ template <typename T> struct BufferElimination : public OpRewritePattern<T> {
49834983 auto opd = map.getResults ()[0 ].dyn_cast <AffineDimExpr>();
49844984 if (!opd)
49854985 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 ()]) );
49884988 if (!val)
49894989 continue ;
49904990
@@ -5033,8 +5033,8 @@ template <typename T> struct BufferElimination : public OpRewritePattern<T> {
50335033 auto opd = map.getResults ()[0 ].dyn_cast <AffineDimExpr>();
50345034 if (!opd)
50355035 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 ()]) );
50385038 if (!val)
50395039 continue ;
50405040
@@ -5279,7 +5279,7 @@ struct AffineBufferElimination : public OpRewritePattern<T> {
52795279 }
52805280 if (storeIdxs[pair.index ()].isValue ) {
52815281 Value auval = storeIdxs[pair.index ()].v_val ;
5282- BlockArgument bval = auval. dyn_cast <BlockArgument>();
5282+ BlockArgument bval = dyn_cast<BlockArgument>(auval );
52835283 if (!bval) {
52845284 LLVM_DEBUG (llvm::dbgs () << " + non bval expr " << bval << " \n " );
52855285 continue ;
@@ -5339,7 +5339,7 @@ struct AffineBufferElimination : public OpRewritePattern<T> {
53395339 if (!VI.isValue )
53405340 continue ;
53415341 auto V = VI.v_val ;
5342- auto BA = V. dyn_cast <BlockArgument>();
5342+ auto BA = dyn_cast<BlockArgument>(V );
53435343 if (!BA) {
53445344 LLVM_DEBUG (llvm::dbgs () << " + non map oper " << V << " \n " );
53455345 return failure ();
@@ -5426,7 +5426,7 @@ struct AffineBufferElimination : public OpRewritePattern<T> {
54265426 if (!VI.isValue )
54275427 continue ;
54285428 auto V = VI.v_val ;
5429- auto BA = V. dyn_cast <BlockArgument>();
5429+ auto BA = dyn_cast<BlockArgument>(V );
54305430 Operation *c = BA.getOwner ()->getParentOp ();
54315431 if (isa<affine::AffineParallelOp>(c) || isa<scf::ParallelOp>(c)) {
54325432 Operation *tmp = store;
@@ -5468,7 +5468,7 @@ struct AffineBufferElimination : public OpRewritePattern<T> {
54685468 if (storeIdxSet.count (V))
54695469 continue ;
54705470
5471- if (auto BA = V. dyn_cast <BlockArgument>()) {
5471+ if (auto BA = dyn_cast<BlockArgument>(V )) {
54725472 Operation *parent = BA.getOwner ()->getParentOp ();
54735473
54745474 if (auto sop = storeVal.getDefiningOp ())
@@ -5518,10 +5518,10 @@ struct AffineBufferElimination : public OpRewritePattern<T> {
55185518 if (!isa<MemoryEffects::Read>(res.getEffect ()))
55195519 return false ;
55205520 unsigned addr = 0 ;
5521- if (auto MT = v. getType (). dyn_cast <MemRefType>())
5521+ if (auto MT = dyn_cast<MemRefType>(v. getType () ))
55225522 addr = MT.getMemorySpaceAsInt ();
55235523 else if (auto LT =
5524- v. getType (). dyn_cast <LLVM::LLVMPointerType>())
5524+ dyn_cast<LLVM::LLVMPointerType>(v. getType () ))
55255525 addr = LT.getAddressSpace ();
55265526 else
55275527 return false ;
0 commit comments