[Mlir-commits] [mlir] 8786cdb - [MLIR][NFC] std::is_same || -> llvm::is_one_of
Uday Bondhugula
llvmlistbot at llvm.org
Tue Mar 24 20:40:40 PDT 2020
Author: Uday Bondhugula
Date: 2020-03-25T09:09:37+05:30
New Revision: 8786cdb3cdfbe5f7a823a122431e1bea675c81f4
URL: https://github.com/llvm/llvm-project/commit/8786cdb3cdfbe5f7a823a122431e1bea675c81f4
DIFF: https://github.com/llvm/llvm-project/commit/8786cdb3cdfbe5f7a823a122431e1bea675c81f4.diff
LOG: [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
Added:
Modified:
mlir/lib/Analysis/LoopAnalysis.cpp
mlir/lib/Analysis/Utils.cpp
mlir/lib/Dialect/Affine/IR/AffineOps.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Analysis/LoopAnalysis.cpp b/mlir/lib/Analysis/LoopAnalysis.cpp
index 9cf8fbc815d2..9b5725188fae 100644
--- a/mlir/lib/Analysis/LoopAnalysis.cpp
+++ b/mlir/lib/Analysis/LoopAnalysis.cpp
@@ -220,9 +220,9 @@ DenseSet<Value> mlir::getInvariantAccesses(Value iv, ArrayRef<Value> indices) {
template <typename LoadOrStoreOp>
static bool isContiguousAccess(Value iv, LoadOrStoreOp memoryOp,
int *memRefDim) {
- static_assert(std::is_same<LoadOrStoreOp, AffineLoadOp>::value ||
- std::is_same<LoadOrStoreOp, AffineStoreOp>::value,
- "Must be called on either const LoadOp & or const StoreOp &");
+ static_assert(
+ llvm::is_one_of<LoadOrStoreOp, AffineLoadOp, AffineStoreOp>::value,
+ "Must be called on either LoadOp or StoreOp");
assert(memRefDim && "memRefDim == nullptr");
auto memRefType = memoryOp.getMemRefType();
diff --git a/mlir/lib/Analysis/Utils.cpp b/mlir/lib/Analysis/Utils.cpp
index 940e07630e20..9e400e4b6a3c 100644
--- a/mlir/lib/Analysis/Utils.cpp
+++ b/mlir/lib/Analysis/Utils.cpp
@@ -368,16 +368,16 @@ Optional<uint64_t> mlir::getMemRefSizeInBytes(MemRefType memRefType) {
return sizeInBytes;
}
-template <typename LoadOrStoreOpPointer>
-LogicalResult mlir::boundCheckLoadOrStoreOp(LoadOrStoreOpPointer loadOrStoreOp,
+template <typename LoadOrStoreOp>
+LogicalResult mlir::boundCheckLoadOrStoreOp(LoadOrStoreOp loadOrStoreOp,
bool emitError) {
- static_assert(std::is_same<LoadOrStoreOpPointer, AffineLoadOp>::value ||
- std::is_same<LoadOrStoreOpPointer, AffineStoreOp>::value,
- "argument should be either a AffineLoadOp or a AffineStoreOp");
+ static_assert(
+ llvm::is_one_of<LoadOrStoreOp, AffineLoadOp, AffineStoreOp>::value,
+ "argument should be either a AffineLoadOp or a AffineStoreOp");
- Operation *opInst = loadOrStoreOp.getOperation();
- MemRefRegion region(opInst->getLoc());
- if (failed(region.compute(opInst, /*loopDepth=*/0, /*sliceState=*/nullptr,
+ Operation *op = loadOrStoreOp.getOperation();
+ MemRefRegion region(op->getLoc());
+ if (failed(region.compute(op, /*loopDepth=*/0, /*sliceState=*/nullptr,
/*addMemRefDimBounds=*/false)))
return success();
diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index 9e1f7e96bb0b..7bf8ab4e07a5 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -629,8 +629,7 @@ static void canonicalizePromotedSymbols(MapOrSet *mapOrSet,
template <class MapOrSet>
static void canonicalizeMapOrSetAndOperands(MapOrSet *mapOrSet,
SmallVectorImpl<Value> *operands) {
- static_assert(std::is_same<MapOrSet, AffineMap>::value ||
- std::is_same<MapOrSet, IntegerSet>::value,
+ static_assert(llvm::is_one_of<MapOrSet, AffineMap, IntegerSet>::value,
"Argument must be either of AffineMap or IntegerSet type");
if (!mapOrSet || operands->empty())
@@ -729,13 +728,10 @@ struct SimplifyAffineOp : public OpRewritePattern<AffineOpTy> {
LogicalResult matchAndRewrite(AffineOpTy affineOp,
PatternRewriter &rewriter) const override {
- static_assert(std::is_same<AffineOpTy, AffineLoadOp>::value ||
- std::is_same<AffineOpTy, AffinePrefetchOp>::value ||
- std::is_same<AffineOpTy, AffineStoreOp>::value ||
- std::is_same<AffineOpTy, AffineApplyOp>::value ||
- std::is_same<AffineOpTy, AffineMinOp>::value ||
- std::is_same<AffineOpTy, AffineMaxOp>::value,
- "affine load/store/apply op expected");
+ static_assert(llvm::is_one_of<AffineOpTy, AffineLoadOp, AffinePrefetchOp,
+ AffineStoreOp, AffineApplyOp, AffineMinOp,
+ AffineMaxOp>::value,
+ "affine load/store/apply/prefetch/min/max op expected");
auto map = affineOp.getAffineMap();
AffineMap oldMap = map;
auto oldOperands = affineOp.getMapOperands();
More information about the Mlir-commits
mailing list