Unbreak VC++ build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31464 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp
index 97587d5..fea03a5 100644
--- a/lib/CodeGen/BranchFolding.cpp
+++ b/lib/CodeGen/BranchFolding.cpp
@@ -25,6 +25,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/STLExtras.h"
+#include <algorithm>
 using namespace llvm;
 
 static Statistic<> NumDeadBlocks("branchfold", "Number of dead blocks removed");
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 5f1b582..03abac2 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -383,7 +383,7 @@
     bool isAlias(SDOperand Ptr1, int64_t Size1,
                  const Value *SrcValue1, int SrcValueOffset1,
                  SDOperand Ptr2, int64_t Size2,
-                 const Value *SrcValue2, int SrcValueOffset1);
+                 const Value *SrcValue2, int SrcValueOffset2);
                  
     /// FindAliasInfo - Extracts the relevant alias information from the memory
     /// node.  Returns true if the operand was a load.
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 6e69728..ef9e3f5 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -1657,16 +1657,16 @@
   return getNode(ISD::VLOAD, getVTList(MVT::Vector, MVT::Other), Ops, 5);
 }
 
-SDOperand SelectionDAG::getStore(SDOperand Chain, SDOperand Value,
+SDOperand SelectionDAG::getStore(SDOperand Chain, SDOperand Val,
                                  SDOperand Ptr, const Value *SV, int SVOffset,
                                  bool isVolatile) {
-  MVT::ValueType VT = Value.getValueType();
+  MVT::ValueType VT = Val.getValueType();
 
   // FIXME: Alignment == 1 for now.
   unsigned Alignment = 1;
   SDVTList VTs = getVTList(MVT::Other);
   SDOperand Undef = getNode(ISD::UNDEF, Ptr.getValueType());
-  SDOperand Ops[] = { Chain, Value, Ptr, Undef };
+  SDOperand Ops[] = { Chain, Val, Ptr, Undef };
   FoldingSetNodeID ID;
   AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4);
   ID.AddInteger(ISD::UNINDEXED);
@@ -1679,7 +1679,7 @@
   void *IP = 0;
   if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
     return SDOperand(E, 0);
-  SDNode *N = new StoreSDNode(Chain, Value, Ptr, Undef, ISD::UNINDEXED, false,
+  SDNode *N = new StoreSDNode(Chain, Val, Ptr, Undef, ISD::UNINDEXED, false,
                               VT, SV, SVOffset, Alignment, isVolatile);
   N->setValueTypes(VTs);
   CSEMap.InsertNode(N, IP);
@@ -1687,11 +1687,11 @@
   return SDOperand(N, 0);
 }
 
-SDOperand SelectionDAG::getTruncStore(SDOperand Chain, SDOperand Value,
+SDOperand SelectionDAG::getTruncStore(SDOperand Chain, SDOperand Val,
                                       SDOperand Ptr, const Value *SV,
                                       int SVOffset, MVT::ValueType SVT,
                                       bool isVolatile) {
-  MVT::ValueType VT = Value.getValueType();
+  MVT::ValueType VT = Val.getValueType();
   bool isTrunc = VT != SVT;
 
   assert(VT > SVT && "Not a truncation?");
@@ -1702,7 +1702,7 @@
   unsigned Alignment = 1;
   SDVTList VTs = getVTList(MVT::Other);
   SDOperand Undef = getNode(ISD::UNDEF, Ptr.getValueType());
-  SDOperand Ops[] = { Chain, Value, Ptr, Undef };
+  SDOperand Ops[] = { Chain, Val, Ptr, Undef };
   FoldingSetNodeID ID;
   AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4);
   ID.AddInteger(ISD::UNINDEXED);
@@ -1715,7 +1715,7 @@
   void *IP = 0;
   if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
     return SDOperand(E, 0);
-  SDNode *N = new StoreSDNode(Chain, Value, Ptr, Undef, ISD::UNINDEXED, isTrunc,
+  SDNode *N = new StoreSDNode(Chain, Val, Ptr, Undef, ISD::UNINDEXED, isTrunc,
                               SVT, SV, SVOffset, Alignment, isVolatile);
   N->setValueTypes(VTs);
   CSEMap.InsertNode(N, IP);
diff --git a/lib/System/Win32/Path.inc b/lib/System/Win32/Path.inc
index 048bf60..1eee2bb 100644
--- a/lib/System/Win32/Path.inc
+++ b/lib/System/Win32/Path.inc
@@ -124,7 +124,12 @@
 
   // Append a subdirectory passed on our process id so multiple LLVMs don't
   // step on each other's toes.
+#ifdef __MINGW32__
+  // Mingw's Win32 header files are broken.
   sprintf(pathname, "LLVM_%u", unsigned(GetCurrentProcessId()));
+#else
+  sprintf(pathname, "LLVM_%u", GetCurrentProcessId());
+#endif
   result.appendComponent(pathname);
 
   // If there's a directory left over from a previous LLVM execution that
diff --git a/lib/Target/X86/X86ISelDAGToDAG.cpp b/lib/Target/X86/X86ISelDAGToDAG.cpp
index 343176d..3957b94 100644
--- a/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -663,7 +663,7 @@
             AM.IndexReg = ShVal.Val->getOperand(0);
             ConstantSDNode *AddVal =
               cast<ConstantSDNode>(ShVal.Val->getOperand(1));
-            uint64_t Disp = AM.Disp + AddVal->getValue() << Val;
+            uint64_t Disp = AM.Disp + (AddVal->getValue() << Val);
             if (isInt32(Disp))
               AM.Disp = Disp;
             else
diff --git a/lib/Target/X86/X86RegisterInfo.h b/lib/Target/X86/X86RegisterInfo.h
index fdab3ee..df43b86 100644
--- a/lib/Target/X86/X86RegisterInfo.h
+++ b/lib/Target/X86/X86RegisterInfo.h
@@ -22,9 +22,11 @@
   class TargetInstrInfo;
   class X86TargetMachine;
 
-struct X86RegisterInfo : public X86GenRegisterInfo {
+class X86RegisterInfo : public X86GenRegisterInfo {
+public:
   X86TargetMachine &TM;
   const TargetInstrInfo &TII;
+
 private:
   /// Is64Bit - Is the target 64-bits.
   bool Is64Bit;
diff --git a/lib/Transforms/Scalar/PredicateSimplifier.cpp b/lib/Transforms/Scalar/PredicateSimplifier.cpp
index ca2762c..47f6d3d 100644
--- a/lib/Transforms/Scalar/PredicateSimplifier.cpp
+++ b/lib/Transforms/Scalar/PredicateSimplifier.cpp
@@ -428,7 +428,7 @@
           // "setlt/gt int %a, %b" NE false then %a NE %b
 
           if (ConstantBool *CB = dyn_cast<ConstantBool>(V1)) {
-            if (CB->getValue() ^ Opcode==NE)
+            if (CB->getValue() ^ (Opcode==NE))
               addNotEqual(BO->getOperand(0), BO->getOperand(1));
 	  }
           break;
@@ -437,7 +437,7 @@
           // "setle/ge int %a, %b" EQ false then %a NE %b
           // "setle/ge int %a, %b" NE true  then %a NE %b
           if (ConstantBool *CB = dyn_cast<ConstantBool>(V1)) {
-            if (CB->getValue() ^ Opcode==EQ)
+            if (CB->getValue() ^ (Opcode==EQ))
               addNotEqual(BO->getOperand(0), BO->getOperand(1));
 	  }
           break;
@@ -486,7 +486,7 @@
           if (ConstantBool *CB = dyn_cast<ConstantBool>(V1)) {
             if (ConstantBool *A = dyn_cast<ConstantBool>(LHS)) {
               addEqual(RHS, ConstantBool::get(A->getValue() ^ CB->getValue()
-                                              ^ Opcode==NE));
+                                              ^ (Opcode==NE)));
             }
           }
           else if (ConstantIntegral *CI = dyn_cast<ConstantIntegral>(V1)) {
diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp
index 30a7add..3aa7397 100644
--- a/lib/Transforms/Utils/CloneFunction.cpp
+++ b/lib/Transforms/Utils/CloneFunction.cpp
@@ -313,9 +313,9 @@
   assert(NameSuffix && "NameSuffix cannot be null!");
   
 #ifndef NDEBUG
-  for (Function::const_arg_iterator I = OldFunc->arg_begin(), 
-       E = OldFunc->arg_end(); I != E; ++I)
-    assert(ValueMap.count(I) && "No mapping from source argument specified!");
+  for (Function::const_arg_iterator II = OldFunc->arg_begin(), 
+       E = OldFunc->arg_end(); II != E; ++II)
+    assert(ValueMap.count(II) && "No mapping from source argument specified!");
 #endif
   
   PruningFunctionCloner PFC(NewFunc, OldFunc, ValueMap, Returns,