Skip to content

Commit 8786cdb

Browse files
committed
[MLIR][NFC] std::is_same || -> llvm::is_one_of
Switch std::is_same disjunctions to llvm::is_one_of Differential Revision: https://reviews.llvm.org/D76745
1 parent c227388 commit 8786cdb

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

mlir/lib/Analysis/LoopAnalysis.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ DenseSet<Value> mlir::getInvariantAccesses(Value iv, ArrayRef<Value> indices) {
220220
template <typename LoadOrStoreOp>
221221
static bool isContiguousAccess(Value iv, LoadOrStoreOp memoryOp,
222222
int *memRefDim) {
223-
static_assert(std::is_same<LoadOrStoreOp, AffineLoadOp>::value ||
224-
std::is_same<LoadOrStoreOp, AffineStoreOp>::value,
225-
"Must be called on either const LoadOp & or const StoreOp &");
223+
static_assert(
224+
llvm::is_one_of<LoadOrStoreOp, AffineLoadOp, AffineStoreOp>::value,
225+
"Must be called on either LoadOp or StoreOp");
226226
assert(memRefDim && "memRefDim == nullptr");
227227
auto memRefType = memoryOp.getMemRefType();
228228

mlir/lib/Analysis/Utils.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -368,16 +368,16 @@ Optional<uint64_t> mlir::getMemRefSizeInBytes(MemRefType memRefType) {
368368
return sizeInBytes;
369369
}
370370

371-
template <typename LoadOrStoreOpPointer>
372-
LogicalResult mlir::boundCheckLoadOrStoreOp(LoadOrStoreOpPointer loadOrStoreOp,
371+
template <typename LoadOrStoreOp>
372+
LogicalResult mlir::boundCheckLoadOrStoreOp(LoadOrStoreOp loadOrStoreOp,
373373
bool emitError) {
374-
static_assert(std::is_same<LoadOrStoreOpPointer, AffineLoadOp>::value ||
375-
std::is_same<LoadOrStoreOpPointer, AffineStoreOp>::value,
376-
"argument should be either a AffineLoadOp or a AffineStoreOp");
374+
static_assert(
375+
llvm::is_one_of<LoadOrStoreOp, AffineLoadOp, AffineStoreOp>::value,
376+
"argument should be either a AffineLoadOp or a AffineStoreOp");
377377

378-
Operation *opInst = loadOrStoreOp.getOperation();
379-
MemRefRegion region(opInst->getLoc());
380-
if (failed(region.compute(opInst, /*loopDepth=*/0, /*sliceState=*/nullptr,
378+
Operation *op = loadOrStoreOp.getOperation();
379+
MemRefRegion region(op->getLoc());
380+
if (failed(region.compute(op, /*loopDepth=*/0, /*sliceState=*/nullptr,
381381
/*addMemRefDimBounds=*/false)))
382382
return success();
383383

mlir/lib/Dialect/Affine/IR/AffineOps.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,7 @@ static void canonicalizePromotedSymbols(MapOrSet *mapOrSet,
629629
template <class MapOrSet>
630630
static void canonicalizeMapOrSetAndOperands(MapOrSet *mapOrSet,
631631
SmallVectorImpl<Value> *operands) {
632-
static_assert(std::is_same<MapOrSet, AffineMap>::value ||
633-
std::is_same<MapOrSet, IntegerSet>::value,
632+
static_assert(llvm::is_one_of<MapOrSet, AffineMap, IntegerSet>::value,
634633
"Argument must be either of AffineMap or IntegerSet type");
635634

636635
if (!mapOrSet || operands->empty())
@@ -729,13 +728,10 @@ struct SimplifyAffineOp : public OpRewritePattern<AffineOpTy> {
729728

730729
LogicalResult matchAndRewrite(AffineOpTy affineOp,
731730
PatternRewriter &rewriter) const override {
732-
static_assert(std::is_same<AffineOpTy, AffineLoadOp>::value ||
733-
std::is_same<AffineOpTy, AffinePrefetchOp>::value ||
734-
std::is_same<AffineOpTy, AffineStoreOp>::value ||
735-
std::is_same<AffineOpTy, AffineApplyOp>::value ||
736-
std::is_same<AffineOpTy, AffineMinOp>::value ||
737-
std::is_same<AffineOpTy, AffineMaxOp>::value,
738-
"affine load/store/apply op expected");
731+
static_assert(llvm::is_one_of<AffineOpTy, AffineLoadOp, AffinePrefetchOp,
732+
AffineStoreOp, AffineApplyOp, AffineMinOp,
733+
AffineMaxOp>::value,
734+
"affine load/store/apply/prefetch/min/max op expected");
739735
auto map = affineOp.getAffineMap();
740736
AffineMap oldMap = map;
741737
auto oldOperands = affineOp.getMapOperands();

0 commit comments

Comments
 (0)