Unbreak VC++ build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34917 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp
index 01aedda..1288674 100644
--- a/lib/Analysis/ConstantFolding.cpp
+++ b/lib/Analysis/ConstantFolding.cpp
@@ -72,8 +72,8 @@
         // N = N + Offset
         Offset += TD.getStructLayout(ST)->getElementOffset(CI->getZExtValue());
       } else {
-        const SequentialType *ST = cast<SequentialType>(*GTI);
-        Offset += TD.getTypeSize(ST->getElementType())*CI->getSExtValue();
+        const SequentialType *SQT = cast<SequentialType>(*GTI);
+        Offset += TD.getTypeSize(SQT->getElementType())*CI->getSExtValue();
       }
     }
     return true;
diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp
index 52b1919..0a281c8 100644
--- a/lib/Analysis/IPA/Andersens.cpp
+++ b/lib/Analysis/IPA/Andersens.cpp
@@ -62,6 +62,7 @@
 #include "llvm/Analysis/Passes.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/ADT/Statistic.h"
+#include <algorithm>
 #include <set>
 using namespace llvm;
 
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index afaf782..27890e9 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -3301,7 +3301,7 @@
     // Flags[2] -> isSRet
     // Flags[1] -> isInReg
     // Flags[0] -> isSigned
-    unsigned Flags = (isSRet << 2) | (isInReg << 1) | isSigned |
+    unsigned Flags = (isSRet << 2) | (isInReg << 1) | unsigned(isSigned) |
       (OriginalAlignment << 27);
 
     switch (getTypeAction(VT)) {
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp
index 683211b..08ec236 100644
--- a/lib/Support/APInt.cpp
+++ b/lib/Support/APInt.cpp
@@ -17,6 +17,7 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/MathExtras.h"
+#include <math.h>
 #include <cstring>
 #include <cstdlib>
 #ifndef NDEBUG
@@ -1224,9 +1225,16 @@
   // an IEEE double precision floating point value), then we can use the
   // libc sqrt function which will probably use a hardware sqrt computation.
   // This should be faster than the algorithm below.
-  if (magnitude < 52)
+  if (magnitude < 52) {
+#ifdef _MSC_VER
+    // Amazingly, VC++ doesn't have round().
+    return APInt(BitWidth, 
+                 uint64_t(::sqrt(double(isSingleWord()?VAL:pVal[0]))) + 0.5);
+#else
     return APInt(BitWidth, 
                  uint64_t(::round(::sqrt(double(isSingleWord()?VAL:pVal[0])))));
+#endif
+  }
 
   // Okay, all the short cuts are exhausted. We must compute it. The following
   // is a classical Babylonian method for computing the square root. This code
diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp
index dfa6d2a..b1f0807 100644
--- a/lib/Target/TargetData.cpp
+++ b/lib/Target/TargetData.cpp
@@ -400,7 +400,7 @@
     unsigned char Alignment;
     Size = getTypeSize(ATy->getElementType());
     Alignment = getABITypeAlignment(ATy->getElementType());
-    unsigned AlignedSize = (Size + Alignment - 1)/Alignment*Alignment;
+    uint64_t AlignedSize = (Size + Alignment - 1)/Alignment*Alignment;
     return AlignedSize*ATy->getNumElements();
   }
   case Type::StructTyID: {
diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp
index aeb4173..ce6db56 100644
--- a/lib/Transforms/IPO/RaiseAllocations.cpp
+++ b/lib/Transforms/IPO/RaiseAllocations.cpp
@@ -22,6 +22,7 @@
 #include "llvm/Support/CallSite.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/ADT/Statistic.h"
+#include <algorithm>
 using namespace llvm;
 
 STATISTIC(NumRaised, "Number of allocations raised");
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 2a08ced..e8dbb73 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -7663,6 +7663,7 @@
                            PhiVal, ConstantOp);
   else
     assert(0 && "Unknown operation");
+  return 0;
 }
 
 /// DeadPHICycle - Return true if this PHI node is only used by a PHI node cycle
diff --git a/lib/Transforms/Scalar/PredicateSimplifier.cpp b/lib/Transforms/Scalar/PredicateSimplifier.cpp
index b425a8c..324cbc6 100644
--- a/lib/Transforms/Scalar/PredicateSimplifier.cpp
+++ b/lib/Transforms/Scalar/PredicateSimplifier.cpp
@@ -421,7 +421,7 @@
           iSGT = iUGT;
           iSLT = iULT;
         } else {
-          assert(iULT->first->getValue().isPositive() >= 0 &&
+          assert(iULT->first->getValue().isPositive() &&
                  iUGT->first->getValue().isNegative() &&"Bad sign comparison.");
           iSGT = iULT;
           iSLT = iUGT;
diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp
index 2e27015..b593d47 100644
--- a/lib/VMCore/Pass.cpp
+++ b/lib/VMCore/Pass.cpp
@@ -19,6 +19,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/TypeInfo.h"
+#include <algorithm>
 #include <set>
 using namespace llvm;
 
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp
index a2bbb7d..470428f 100644
--- a/lib/VMCore/PassManager.cpp
+++ b/lib/VMCore/PassManager.cpp
@@ -19,6 +19,7 @@
 #include "llvm/ModuleProvider.h"
 #include "llvm/Support/Streams.h"
 #include "llvm/Support/ManagedStatic.h"
+#include <algorithm>
 #include <vector>
 #include <map>
 
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp
index 4c76b2b..8bc99a8 100644
--- a/lib/VMCore/Value.cpp
+++ b/lib/VMCore/Value.cpp
@@ -128,7 +128,7 @@
 
 void Value::setName(const char *NameStr, unsigned NameLen) {
   if (NameLen == 0 && !hasName()) return;
-  if (getType() != Type::VoidTy && "Cannot assign a name to void values!");
+  assert(getType() != Type::VoidTy && "Cannot assign a name to void values!");
   
   // Get the symbol table to update for this object.
   ValueSymbolTable *ST;