[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
This commit is contained in:
Uday Bondhugula 2020-03-25 07:53:05 +05:30
parent c2273883e2
commit 8786cdb3cd
3 changed files with 16 additions and 20 deletions

View File

@ -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();

View File

@ -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();

View File

@ -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();