Explicitly cast narrowing conversions inside {}s that will become errors in
authorJeffrey Yasskin <jyasskin@google.com>
Wed, 27 Jul 2011 06:22:51 +0000 (06:22 +0000)
committerJeffrey Yasskin <jyasskin@google.com>
Wed, 27 Jul 2011 06:22:51 +0000 (06:22 +0000)
C++0x.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136211 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/BasicAliasAnalysis.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
lib/Target/X86/X86CodeEmitter.cpp
lib/Target/X86/X86ISelLowering.cpp
unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp

index 116076ce2a993f7e9c6b38aeff3eeb759140bf5f..01257a1f2af9422cdebaa49462c18f67cb6da8ef 100644 (file)
@@ -374,7 +374,8 @@ DecomposeGEPExpression(const Value *V, int64_t &BaseOffs,
       }
       
       if (Scale) {
-        VariableGEPIndex Entry = {Index, Extension, Scale};
+        VariableGEPIndex Entry = {Index, Extension,
+                                  static_cast<int64_t>(Scale)};
         VarIndices.push_back(Entry);
       }
     }
index 649a38aff0c6b846e6ef59c0a185d6771b624829..a101df0d1557fc6e12b9cd23cc68a4c89c98ba6d 100644 (file)
@@ -2778,7 +2778,8 @@ void SelectionDAGBuilder::visitShuffleVector(const User &I) {
     // Analyze the access pattern of the vector to see if we can extract
     // two subvectors and do the shuffle. The analysis is done by calculating
     // the range of elements the mask access on both vectors.
-    int MinRange[2] = { SrcNumElts+1, SrcNumElts+1};
+    int MinRange[2] = { static_cast<int>(SrcNumElts+1),
+                        static_cast<int>(SrcNumElts+1)};
     int MaxRange[2] = {-1, -1};
 
     for (unsigned i = 0; i != MaskNumElts; ++i) {
index 7a56e5c5a292e333e33fe7744b122873ab863ef2..bd7ee0a549443839c505120163e441b1f76a110c 100644 (file)
@@ -357,7 +357,7 @@ void X86MCCodeEmitter::EmitMemModRMByte(const MCInst &MI, unsigned Op,
   }
 
   // Calculate what the SS field value should be...
-  static const unsigned SSTable[] = { ~0, 0, 1, ~0, 2, ~0, ~0, ~0, 3 };
+  static const unsigned SSTable[] = { ~0U, 0, 1, ~0U, 2, ~0U, ~0U, ~0U, 3 };
   unsigned SS = SSTable[Scale.getImm()];
 
   if (BaseReg == 0) {
index fbef826962953456b77ef313d9f7df6ced67ad85..aeff03a89ec9bc08a15d0011273c62faafdd061c 100644 (file)
@@ -559,7 +559,7 @@ void Emitter<CodeEmitter>::emitMemModRMByte(const MachineInstr &MI,
   }
 
   // Calculate what the SS field value should be...
-  static const unsigned SSTable[] = { ~0, 0, 1, ~0, 2, ~0, ~0, ~0, 3 };
+  static const unsigned SSTable[] = { ~0U, 0, 1, ~0U, 2, ~0U, ~0U, ~0U, 3 };
   unsigned SS = SSTable[Scale.getImm()];
 
   if (BaseReg == 0) {
index 4d914b5e314fcecacd75bc1ad0055b86f5e288dd..3657ac069690e2ce03c2f79c2387d47241f6405c 100644 (file)
@@ -6357,7 +6357,7 @@ X86TargetLowering::LowerEXTRACT_VECTOR_ELT(SDValue Op,
       return Op;
 
     // SHUFPS the element to the lowest double word, then movss.
-    int Mask[4] = { Idx, -1, -1, -1 };
+    int Mask[4] = { static_cast<int>(Idx), -1, -1, -1 };
     EVT VVT = Op.getOperand(0).getValueType();
     SDValue Vec = DAG.getVectorShuffle(VVT, dl, Op.getOperand(0),
                                        DAG.getUNDEF(VVT), Mask);
index a36ec3bf2a1be054a0bcadd7389c53bde1a69a20..01cb7a98b326e755889fb7b35ce50ec2f5445ed6 100644 (file)
@@ -45,7 +45,7 @@ struct RecordingJITEventListener : public JITEventListener {
   std::vector<FunctionEmittedEvent> EmittedEvents;
   std::vector<FunctionFreedEvent> FreedEvents;
 
-  int NextIndex;
+  unsigned NextIndex;
 
   RecordingJITEventListener() : NextIndex(0) {}