[Mlir-commits] [mlir] 6b74a5a - Revert "[MLIR] Use `llvm::is_one_of` in walk templates"

Frederik Gossen llvmlistbot at llvm.org
Mon Nov 2 08:21:50 PST 2020


Author: Frederik Gossen
Date: 2020-11-02T16:21:29Z
New Revision: 6b74a5aab11fcc7610e5991de0f1b06b652aea98

URL: https://github.com/llvm/llvm-project/commit/6b74a5aab11fcc7610e5991de0f1b06b652aea98
DIFF: https://github.com/llvm/llvm-project/commit/6b74a5aab11fcc7610e5991de0f1b06b652aea98.diff

LOG: Revert "[MLIR] Use `llvm::is_one_of` in walk templates"

This reverts commit 56299b1e58bf3720dff2fe60163739ee1554a371.
Cannot build with gcc/g++ 7.5.0.

Added: 
    

Modified: 
    mlir/include/mlir/IR/Visitors.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/Visitors.h b/mlir/include/mlir/IR/Visitors.h
index 74aabbdebe3e..cf7b3fa5db1c 100644
--- a/mlir/include/mlir/IR/Visitors.h
+++ b/mlir/include/mlir/IR/Visitors.h
@@ -92,8 +92,10 @@ WalkResult walk(Operation *op, function_ref<WalkResult(Operation *)> callback);
 template <
     typename FuncTy, typename ArgT = detail::first_argument<FuncTy>,
     typename RetT = decltype(std::declval<FuncTy>()(std::declval<ArgT>()))>
-typename std::enable_if<
-    llvm::is_one_of<ArgT, Operation *, Region *, Block *>::value, RetT>::type
+typename std::enable_if<std::is_same<ArgT, Operation *>::value ||
+                            std::is_same<ArgT, Region *>::value ||
+                            std::is_same<ArgT, Block *>::value,
+                        RetT>::type
 walk(Operation *op, FuncTy &&callback) {
   return walk(op, function_ref<RetT(ArgT)>(callback));
 }
@@ -107,10 +109,11 @@ walk(Operation *op, FuncTy &&callback) {
 template <
     typename FuncTy, typename ArgT = detail::first_argument<FuncTy>,
     typename RetT = decltype(std::declval<FuncTy>()(std::declval<ArgT>()))>
-typename std::enable_if<
-    !llvm::is_one_of<ArgT, Operation *, Region *, Block *>::value &&
-        std::is_same<RetT, void>::value,
-    RetT>::type
+typename std::enable_if<!std::is_same<ArgT, Operation *>::value &&
+                            !std::is_same<ArgT, Region *>::value &&
+                            !std::is_same<ArgT, Block *>::value &&
+                            std::is_same<RetT, void>::value,
+                        RetT>::type
 walk(Operation *op, FuncTy &&callback) {
   auto wrapperFn = [&](Operation *op) {
     if (auto derivedOp = dyn_cast<ArgT>(op))
@@ -132,10 +135,11 @@ walk(Operation *op, FuncTy &&callback) {
 template <
     typename FuncTy, typename ArgT = detail::first_argument<FuncTy>,
     typename RetT = decltype(std::declval<FuncTy>()(std::declval<ArgT>()))>
-typename std::enable_if<
-    !llvm::is_one_of<ArgT, Operation *, Region *, Block *>::value &&
-        std::is_same<RetT, WalkResult>::value,
-    RetT>::type
+typename std::enable_if<!std::is_same<ArgT, Operation *>::value &&
+                            !std::is_same<ArgT, Region *>::value &&
+                            !std::is_same<ArgT, Block *>::value &&
+                            std::is_same<RetT, WalkResult>::value,
+                        RetT>::type
 walk(Operation *op, FuncTy &&callback) {
   auto wrapperFn = [&](Operation *op) {
     if (auto derivedOp = dyn_cast<ArgT>(op))


        


More information about the Mlir-commits mailing list