[PATCH] D76745: [MLIR][NFC] std::is_same || -> llvm::is_one_of

Uday Bondhugula via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 24 20:48:05 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG8786cdb3cdfb: [MLIR][NFC] std::is_same || -> llvm::is_one_of (authored by bondhugula).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76745/new/

https://reviews.llvm.org/D76745

Files:
  mlir/lib/Analysis/LoopAnalysis.cpp
  mlir/lib/Analysis/Utils.cpp
  mlir/lib/Dialect/Affine/IR/AffineOps.cpp


Index: mlir/lib/Dialect/Affine/IR/AffineOps.cpp
===================================================================
--- mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -629,8 +629,7 @@
 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 @@
 
   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();
Index: mlir/lib/Analysis/Utils.cpp
===================================================================
--- mlir/lib/Analysis/Utils.cpp
+++ mlir/lib/Analysis/Utils.cpp
@@ -368,16 +368,16 @@
   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();
 
Index: mlir/lib/Analysis/LoopAnalysis.cpp
===================================================================
--- mlir/lib/Analysis/LoopAnalysis.cpp
+++ mlir/lib/Analysis/LoopAnalysis.cpp
@@ -220,9 +220,9 @@
 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();
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76745.252489.patch
Type: text/x-patch
Size: 3928 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200325/9103d1c3/attachment.bin>


More information about the llvm-commits mailing list