Skip to content

Commit e154dd4

Browse files
committed
Use pattern matcher
1 parent 7955fe0 commit e154dd4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "mlir/IR/Attributes.h"
2020
#include "mlir/IR/BuiltinAttributes.h"
2121
#include "mlir/IR/BuiltinTypes.h"
22+
#include "mlir/IR/Matchers.h"
2223
#include "mlir/IR/TypeUtilities.h"
2324
#include "mlir/Pass/Pass.h"
2425

@@ -2357,10 +2358,8 @@ struct AMDGPUMakeDmaDescriptorLowering
23572358
value = LLVM::ShlOp::create(rewriter, loc, value, shiftAmount);
23582359
}
23592360

2360-
if (LLVM::ConstantOp op = accumulator.getDefiningOp<LLVM::ConstantOp>())
2361-
if (IntegerAttr attr = dyn_cast<IntegerAttr>(op.getValue());
2362-
attr.getInt() == 0)
2363-
return value;
2361+
if (matchPattern(accumulator, mlir::m_Zero()))
2362+
return value;
23642363

23652364
return LLVM::OrOp::create(rewriter, loc, accumulator, value);
23662365
}

0 commit comments

Comments
 (0)