[llvm] 5b5833b - SelectionDAG: repair the Windows build

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 14 08:25:44 PDT 2021


Author: Saleem Abdulrasool
Date: 2021-06-14T08:25:36-07:00
New Revision: 5b5833b9e092bd6808818615c2e4816995382b55

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

LOG: SelectionDAG: repair the Windows build

6e5628354e22f3ca40b04295bac540843b8e6482 regressed the Windows build as
the return type no longer matched in both branches for the return value
type deduction.  This uses a bit more compiler magic to deal with that.

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 8731cdc9f4b6..88561bd39ce5 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -19271,7 +19271,7 @@ template <typename R, typename T>
 static auto getFirstIndexOf(R &&Range, const T &Val) {
   auto I = find(Range, Val);
   if (I == Range.end())
-    return -1L;
+    return static_cast<decltype(std::distance(Range.begin(), I))>(-1);
   return std::distance(Range.begin(), I);
 }
 


        


More information about the llvm-commits mailing list