[GVNHoist] Fix a signed/unsigned comparison warning that occurs in 32-bit builds...
authorCraig Topper <craig.topper@intel.com>
Thu, 16 Nov 2017 00:19:59 +0000 (00:19 +0000)
committerCraig Topper <craig.topper@intel.com>
Thu, 16 Nov 2017 00:19:59 +0000 (00:19 +0000)
std::distance returns ptrdiff_t which is signed. 64-bit builds don't notice because type promotion widens the unsigned first.

llvm-svn: 318354

llvm/lib/Transforms/Scalar/GVNHoist.cpp

index e90c89c..3b55184 100644 (file)
@@ -578,7 +578,7 @@ private:
 
   // Returns true when the values are flowing out to each edge.
   bool valueAnticipable(CHIArgs C, TerminatorInst *TI) const {
-    if (TI->getNumSuccessors() > std::distance(C.begin(), C.end()))
+    if (TI->getNumSuccessors() > (unsigned)std::distance(C.begin(), C.end()))
       return false; // Not enough args in this CHI.
 
     for (auto CHI : C) {