[llvm-branch-commits] [mlir] f80b630 - [mlir][PDL] Use explicit loop over llvm::find to fix MSVC breakage

River Riddle via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Dec 2 10:50:44 PST 2020


Author: River Riddle
Date: 2020-12-02T10:43:16-08:00
New Revision: f80b630460e2a1646fe432f919fa378cabb002c8

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

LOG: [mlir][PDL] Use explicit loop over llvm::find to fix MSVC breakage

Added: 
    

Modified: 
    mlir/lib/Rewrite/ByteCode.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Rewrite/ByteCode.cpp b/mlir/lib/Rewrite/ByteCode.cpp
index 33a754bb3c07..481e7b6db1d1 100644
--- a/mlir/lib/Rewrite/ByteCode.cpp
+++ b/mlir/lib/Rewrite/ByteCode.cpp
@@ -769,8 +769,10 @@ class ByteCodeExecutor {
 
     // Check to see if the attribute value is within the case list. Jump to
     // the correct successor index based on the result.
-    auto it = llvm::find(cases, value);
-    selectJump(it == cases.end() ? size_t(0) : ((it - cases.begin()) + 1));
+    for (auto it = cases.begin(), e = cases.end(); it != e; ++it)
+      if (*it == value)
+        return selectJump(size_t((it - cases.begin()) + 1));
+    selectJump(size_t(0));
   }
 
   /// Internal implementation of reading various data types from the bytecode


        


More information about the llvm-branch-commits mailing list