Fix some constructs that gcc-4.4 warns about.
authorDuncan Sands <baldrick@free.fr>
Tue, 27 May 2008 11:50:51 +0000 (11:50 +0000)
committerDuncan Sands <baldrick@free.fr>
Tue, 27 May 2008 11:50:51 +0000 (11:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51591 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/IPA/Andersens.cpp
lib/CodeGen/RegisterScavenging.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/Target/CBackend/CBackend.cpp
lib/Transforms/IPO/ArgumentPromotion.cpp
lib/Transforms/Scalar/JumpThreading.cpp

index e6a6e2e37c37b5707d2efc621cbbbee05a3826ab..c6075e1c6106c2c799af952ddaf17c9ad5c468ca 100644 (file)
@@ -2724,13 +2724,14 @@ unsigned Andersens::UniteNodes(unsigned First, unsigned Second,
   DOUT << "\n";
 
   if (SDTActive)
-    if (SDT[Second] >= 0)
+    if (SDT[Second] >= 0) {
       if (SDT[First] < 0)
         SDT[First] = SDT[Second];
       else {
         UniteNodes( FindNode(SDT[First]), FindNode(SDT[Second]) );
         First = FindNode(First);
       }
+    }
 
   return First;
 }
index 1d9effb11085a76c1a9dc0de72d6dbec3b15b404..e8329781ac3d7cca5c4b43ec9ac73c9b1db5d439 100644 (file)
@@ -37,11 +37,12 @@ static bool RedefinesSuperRegPart(const MachineInstr *MI, unsigned SubReg,
     const MachineOperand &MO = MI->getOperand(i);
     if (!MO.isRegister())
       continue;
-    if (TRI->isSuperRegister(SubReg, MO.getReg()))
+    if (TRI->isSuperRegister(SubReg, MO.getReg())) {
       if (MO.isUse())
         SeenSuperUse = true;
       else if (MO.isImplicit())
         SeenSuperDef = true;
+    }
   }
 
   return SeenSuperDef && SeenSuperUse;
index ff505f2c0db0971c7ac4d6bb5d46045aa11f4df5..44c72b6bec4c89cc1a1d02be1b61866ed042b39c 100644 (file)
@@ -2986,7 +2986,7 @@ SelectionDAG::getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType,
   }
 
   bool Indexed = AM != ISD::UNINDEXED;
-  assert(Indexed || Offset.getOpcode() == ISD::UNDEF &&
+  assert((Indexed || Offset.getOpcode() == ISD::UNDEF) &&
          "Unindexed load with an offset!");
 
   SDVTList VTs = Indexed ?
index 4036d08f6278c0994a783ef22f3195e3130fc8ce..2ace6ebd8b60a40df9b4629a8a976c3ee7edc6fc 100644 (file)
@@ -3205,11 +3205,12 @@ void CWriter::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
         Out << "((";
         printType(Out, PointerType::getUnqual(EltTy));
         Out << ")(&" << GetValueName(Op)
-            << "))[" << (SrcVal & NumElts-1) << "]";
+            << "))[" << (SrcVal & (NumElts-1)) << "]";
       } else if (isa<ConstantAggregateZero>(Op) || isa<UndefValue>(Op)) {
         Out << "0";
       } else {
-        printConstant(cast<ConstantVector>(Op)->getOperand(SrcVal & NumElts-1));
+        printConstant(cast<ConstantVector>(Op)->getOperand(SrcVal &
+                                                           (NumElts-1)));
       }
     }
   }
index 7dd94f5bc82539da6c0f3ec034fdaf5c902f5271..7feb1744a06e4855e8d9a7c0f1b7c6a35135a023 100644 (file)
@@ -148,7 +148,7 @@ bool ArgPromotion::PromoteArguments(CallGraphNode *CGN) {
     Argument *PtrArg = PointerArgs[i].first;
     if (isByVal) {
       const Type *AgTy = cast<PointerType>(PtrArg->getType())->getElementType();
-      if (const StructType *STy = dyn_cast<StructType>(AgTy))
+      if (const StructType *STy = dyn_cast<StructType>(AgTy)) {
         if (maxElements > 0 && STy->getNumElements() > maxElements) {
           DOUT << "argpromotion disable promoting argument '"
                << PtrArg->getName() << "' because it would require adding more "
@@ -170,6 +170,7 @@ bool ArgPromotion::PromoteArguments(CallGraphNode *CGN) {
             continue;
           }
         }
+      }
     }
     
     // Otherwise, see if we can promote the pointer to its value.
index 407d081b78157e60202b9cfd0d60f70a1c5fc68c..4e57f0e74cd3c24793e819b3a23f2899b008f078 100644 (file)
@@ -282,8 +282,8 @@ bool JumpThreading::ProcessBranchOnLogical(Value *V, BasicBlock *BB,
   // If this is a binary operator tree of the same AND/OR opcode, check the
   // LHS/RHS.
   if (BinaryOperator *BO = dyn_cast<BinaryOperator>(V))
-    if (isAnd && BO->getOpcode() == Instruction::And ||
-        !isAnd && BO->getOpcode() == Instruction::Or) {
+    if ((isAnd && BO->getOpcode() == Instruction::And) ||
+        (!isAnd && BO->getOpcode() == Instruction::Or)) {
       if (ProcessBranchOnLogical(BO->getOperand(0), BB, isAnd))
         return true;
       if (ProcessBranchOnLogical(BO->getOperand(1), BB, isAnd))