summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/ADT/BitVector.h3
-rw-r--r--include/llvm/ADT/DenseMap.h2
-rw-r--r--include/llvm/ADT/ilist1
-rw-r--r--include/llvm/Analysis/LoopInfo.h3
-rw-r--r--include/llvm/Analysis/ScalarEvolutionExpressions.h3
-rw-r--r--include/llvm/CodeGen/MachineRegisterInfo.h8
-rw-r--r--include/llvm/CodeGen/SelectionDAGNodes.h4
-rw-r--r--include/llvm/Target/SubtargetFeature.h1
-rw-r--r--include/llvm/Target/TargetJITInfo.h3
-rw-r--r--lib/Analysis/Analysis.cpp1
-rw-r--r--lib/Analysis/IPA/Andersens.cpp4
-rw-r--r--lib/Analysis/IPA/GlobalsModRef.cpp3
-rw-r--r--lib/Analysis/ScalarEvolution.cpp3
-rw-r--r--lib/Archive/Archive.cpp2
-rw-r--r--lib/Archive/ArchiveInternals.h2
-rw-r--r--lib/AsmParser/LLLexer.cpp2
-rw-r--r--lib/AsmParser/Parser.cpp1
-rw-r--r--lib/Bitcode/Reader/BitReader.cpp1
-rw-r--r--lib/CodeGen/MachOWriter.cpp1
-rw-r--r--lib/ExecutionEngine/ExecutionEngine.cpp3
-rw-r--r--lib/ExecutionEngine/ExecutionEngineBindings.cpp1
-rw-r--r--lib/ExecutionEngine/Interpreter/Execution.cpp3
-rw-r--r--lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp1
-rw-r--r--lib/ExecutionEngine/Interpreter/Interpreter.cpp1
-rw-r--r--lib/ExecutionEngine/JIT/JITMemoryManager.cpp2
-rw-r--r--lib/Support/CommandLine.cpp1
-rw-r--r--lib/Support/FileUtilities.cpp1
-rw-r--r--lib/Support/FoldingSet.cpp1
-rw-r--r--lib/Support/Statistic.cpp1
-rw-r--r--lib/Support/StringExtras.cpp1
-rw-r--r--lib/Target/Sparc/SparcAsmPrinter.cpp1
-rw-r--r--lib/Target/X86/X86JITInfo.cpp1
-rw-r--r--lib/Transforms/IPO/SimplifyLibCalls.cpp1
-rw-r--r--lib/Transforms/Scalar/LoopUnroll.cpp3
-rw-r--r--lib/VMCore/AutoUpgrade.cpp1
-rw-r--r--lib/VMCore/ConstantFold.cpp21
-rw-r--r--lib/VMCore/Core.cpp1
-rw-r--r--lib/VMCore/Instructions.cpp17
-rw-r--r--lib/VMCore/Value.cpp2
-rw-r--r--tools/llvm-ld/llvm-ld.cpp1
-rw-r--r--tools/llvm-upgrade/UpgradeInternals.h2
-rw-r--r--tools/llvmc/llvmc.cpp1
-rw-r--r--utils/PerfectShuffle/PerfectShuffle.cpp2
-rw-r--r--utils/TableGen/AsmWriterEmitter.cpp3
-rw-r--r--utils/TableGen/CodeGenDAGPatterns.cpp4
-rw-r--r--utils/TableGen/CodeGenRegisters.h3
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp3
-rw-r--r--utils/TableGen/TGLexer.cpp2
48 files changed, 93 insertions, 40 deletions
diff --git a/include/llvm/ADT/BitVector.h b/include/llvm/ADT/BitVector.h
index 3ff2441637c..a3a89201864 100644
--- a/include/llvm/ADT/BitVector.h
+++ b/include/llvm/ADT/BitVector.h
@@ -16,8 +16,9 @@
#include "llvm/Support/MathExtras.h"
#include <algorithm>
-#include <cstdlib>
#include <cassert>
+#include <cstdlib>
+#include <cstring>
namespace llvm {
diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h
index fdfb3294ea3..b29c6915627 100644
--- a/include/llvm/ADT/DenseMap.h
+++ b/include/llvm/ADT/DenseMap.h
@@ -313,7 +313,7 @@ private:
NumEntries = 0;
NumTombstones = 0;
NumBuckets = InitBuckets;
- assert(InitBuckets && (InitBuckets & InitBuckets-1) == 0 &&
+ assert(InitBuckets && (InitBuckets & (InitBuckets-1)) == 0 &&
"# initial buckets must be a power of two!");
Buckets = reinterpret_cast<BucketT*>(new char[sizeof(BucketT)*InitBuckets]);
// Initialize all the keys to EmptyKey.
diff --git a/include/llvm/ADT/ilist b/include/llvm/ADT/ilist
index d58db80a0ad..fe55f5ced9c 100644
--- a/include/llvm/ADT/ilist
+++ b/include/llvm/ADT/ilist
@@ -40,6 +40,7 @@
#include "llvm/ADT/iterator"
#include <cassert>
+#include <cstdlib>
namespace llvm {
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h
index 4cb03fbd8e7..789b9048578 100644
--- a/include/llvm/Analysis/LoopInfo.h
+++ b/include/llvm/Analysis/LoopInfo.h
@@ -404,13 +404,14 @@ public:
if (BranchInst *BI = dyn_cast<BranchInst>(BackedgeBlock->getTerminator()))
if (BI->isConditional()) {
if (ICmpInst *ICI = dyn_cast<ICmpInst>(BI->getCondition())) {
- if (ICI->getOperand(0) == Inc)
+ if (ICI->getOperand(0) == Inc) {
if (BI->getSuccessor(0) == getHeader()) {
if (ICI->getPredicate() == ICmpInst::ICMP_NE)
return ICI->getOperand(1);
} else if (ICI->getPredicate() == ICmpInst::ICMP_EQ) {
return ICI->getOperand(1);
}
+ }
}
}
diff --git a/include/llvm/Analysis/ScalarEvolutionExpressions.h b/include/llvm/Analysis/ScalarEvolutionExpressions.h
index 905493a4af8..39b083d5fac 100644
--- a/include/llvm/Analysis/ScalarEvolutionExpressions.h
+++ b/include/llvm/Analysis/ScalarEvolutionExpressions.h
@@ -253,11 +253,12 @@ namespace llvm {
virtual bool hasComputableLoopEvolution(const Loop *L) const {
bool HasVarying = false;
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
- if (!getOperand(i)->isLoopInvariant(L))
+ if (!getOperand(i)->isLoopInvariant(L)) {
if (getOperand(i)->hasComputableLoopEvolution(L))
HasVarying = true;
else
return false;
+ }
return HasVarying;
}
diff --git a/include/llvm/CodeGen/MachineRegisterInfo.h b/include/llvm/CodeGen/MachineRegisterInfo.h
index 453fe2c8343..48e8e55b296 100644
--- a/include/llvm/CodeGen/MachineRegisterInfo.h
+++ b/include/llvm/CodeGen/MachineRegisterInfo.h
@@ -211,8 +211,8 @@ public:
// If the first node isn't one we're interested in, advance to one that
// we are interested in.
if (op) {
- if (!ReturnUses && op->isUse() ||
- !ReturnDefs && op->isDef())
+ if ((!ReturnUses && op->isUse()) ||
+ (!ReturnDefs && op->isDef()))
++*this;
}
}
@@ -240,8 +240,8 @@ public:
Op = Op->getNextOperandForReg();
// If this is an operand we don't care about, skip it.
- while (Op && (!ReturnUses && Op->isUse() ||
- !ReturnDefs && Op->isDef()))
+ while (Op && ((!ReturnUses && Op->isUse()) ||
+ (!ReturnDefs && Op->isDef())))
Op = Op->getNextOperandForReg();
return *this;
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h
index d6a492d0c19..c1a50bb7dc7 100644
--- a/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -843,8 +843,8 @@ template<> struct DenseMapInfo<SDOperand> {
static inline SDOperand getEmptyKey() { return SDOperand((SDNode*)-1, -1U); }
static inline SDOperand getTombstoneKey() { return SDOperand((SDNode*)-1, 0);}
static unsigned getHashValue(const SDOperand &Val) {
- return (unsigned)((uintptr_t)Val.Val >> 4) ^
- (unsigned)((uintptr_t)Val.Val >> 9) + Val.ResNo;
+ return ((unsigned)((uintptr_t)Val.Val >> 4) ^
+ (unsigned)((uintptr_t)Val.Val >> 9)) + Val.ResNo;
}
static bool isEqual(const SDOperand &LHS, const SDOperand &RHS) {
return LHS == RHS;
diff --git a/include/llvm/Target/SubtargetFeature.h b/include/llvm/Target/SubtargetFeature.h
index 98a589213a2..d187daac0c8 100644
--- a/include/llvm/Target/SubtargetFeature.h
+++ b/include/llvm/Target/SubtargetFeature.h
@@ -21,6 +21,7 @@
#include <string>
#include <vector>
#include <iosfwd>
+#include <cstring>
#include "llvm/Support/DataTypes.h"
namespace llvm {
diff --git a/include/llvm/Target/TargetJITInfo.h b/include/llvm/Target/TargetJITInfo.h
index 1ad927b9b04..98d17c409e5 100644
--- a/include/llvm/Target/TargetJITInfo.h
+++ b/include/llvm/Target/TargetJITInfo.h
@@ -17,8 +17,9 @@
#ifndef LLVM_TARGET_TARGETJITINFO_H
#define LLVM_TARGET_TARGETJITINFO_H
-#include <cassert>
#include <vector>
+#include <cassert>
+#include "llvm/Support/DataTypes.h"
namespace llvm {
class Function;
diff --git a/lib/Analysis/Analysis.cpp b/lib/Analysis/Analysis.cpp
index 2c52dbd2ebb..6b741bc5bdf 100644
--- a/lib/Analysis/Analysis.cpp
+++ b/lib/Analysis/Analysis.cpp
@@ -10,6 +10,7 @@
#include "llvm-c/Analysis.h"
#include "llvm/Analysis/Verifier.h"
#include <fstream>
+#include <cstring>
using namespace llvm;
diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp
index 037f33145a2..399ce1f45df 100644
--- a/lib/Analysis/IPA/Andersens.cpp
+++ b/lib/Analysis/IPA/Andersens.cpp
@@ -139,7 +139,7 @@ namespace {
Constraint(ConstraintType Ty, unsigned D, unsigned S, unsigned O = 0)
: Type(Ty), Dest(D), Src(S), Offset(O) {
- assert(Offset == 0 || Ty != AddressOf &&
+ assert((Offset == 0 || Ty != AddressOf) &&
"Offset is illegal on addressof constraints");
}
@@ -1931,7 +1931,7 @@ void Andersens::RewriteConstraints() {
C.Src = FindEquivalentNode(RHSNode, RHSLabel);
C.Dest = FindEquivalentNode(FindNode(LHSNode), LHSLabel);
- if (C.Src == C.Dest && C.Type == Constraint::Copy
+ if ((C.Src == C.Dest && C.Type == Constraint::Copy)
|| Seen.count(C))
continue;
diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/IPA/GlobalsModRef.cpp
index 880298ec020..9aafe375b42 100644
--- a/lib/Analysis/IPA/GlobalsModRef.cpp
+++ b/lib/Analysis/IPA/GlobalsModRef.cpp
@@ -115,11 +115,12 @@ namespace {
/// case the most generic behavior of this function should be returned.
virtual ModRefBehavior getModRefBehavior(Function *F, CallSite CS,
std::vector<PointerAccessInfo> *Info) {
- if (FunctionRecord *FR = getFunctionInfo(F))
+ if (FunctionRecord *FR = getFunctionInfo(F)) {
if (FR->FunctionEffect == 0)
return DoesNotAccessMemory;
else if ((FR->FunctionEffect & Mod) == 0)
return OnlyReadsMemory;
+ }
return AliasAnalysis::getModRefBehavior(F, CS, Info);
}
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 7f1cac0f43d..30cf950d571 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -2145,13 +2145,14 @@ static PHINode *getConstantEvolvingPHI(Value *V, const Loop *L) {
Instruction *I = dyn_cast<Instruction>(V);
if (I == 0 || !L->contains(I->getParent())) return 0;
- if (PHINode *PN = dyn_cast<PHINode>(I))
+ if (PHINode *PN = dyn_cast<PHINode>(I)) {
if (L->getHeader() == I->getParent())
return PN;
else
// We don't currently keep track of the control flow needed to evaluate
// PHIs, so we cannot handle PHIs inside of loops.
return 0;
+ }
// If we won't be able to constant fold this expression even if the operands
// are constants, return early.
diff --git a/lib/Archive/Archive.cpp b/lib/Archive/Archive.cpp
index 4eb9efbab8e..22934d51fe3 100644
--- a/lib/Archive/Archive.cpp
+++ b/lib/Archive/Archive.cpp
@@ -18,6 +18,8 @@
#include "llvm/Module.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/System/Process.h"
+#include <memory>
+#include <cstring>
using namespace llvm;
// getMemberSize - compute the actual physical size of the file member as seen
diff --git a/lib/Archive/ArchiveInternals.h b/lib/Archive/ArchiveInternals.h
index 2e16933830c..7ba30244a21 100644
--- a/lib/Archive/ArchiveInternals.h
+++ b/lib/Archive/ArchiveInternals.h
@@ -18,6 +18,8 @@
#include "llvm/System/TimeValue.h"
#include "llvm/ADT/StringExtras.h"
+#include <cstring>
+
#define ARFILE_MAGIC "!<arch>\n" ///< magic string
#define ARFILE_MAGIC_LEN (sizeof(ARFILE_MAGIC)-1) ///< length of magic string
#define ARFILE_SVR4_SYMTAB_NAME "/ " ///< SVR4 symtab entry name
diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp
index 7c79c613cf8..f78079b6062 100644
--- a/lib/AsmParser/LLLexer.cpp
+++ b/lib/AsmParser/LLLexer.cpp
@@ -18,6 +18,8 @@
#include <list>
#include "llvmAsmParser.h"
+
+#include <cstring>
using namespace llvm;
//===----------------------------------------------------------------------===//
diff --git a/lib/AsmParser/Parser.cpp b/lib/AsmParser/Parser.cpp
index ba77a64ad82..157a43b1aa2 100644
--- a/lib/AsmParser/Parser.cpp
+++ b/lib/AsmParser/Parser.cpp
@@ -14,6 +14,7 @@
#include "ParserInternals.h"
#include "llvm/Module.h"
#include "llvm/Support/MemoryBuffer.h"
+#include <cstring>
using namespace llvm;
diff --git a/lib/Bitcode/Reader/BitReader.cpp b/lib/Bitcode/Reader/BitReader.cpp
index 9a77c007ecf..52851cd142d 100644
--- a/lib/Bitcode/Reader/BitReader.cpp
+++ b/lib/Bitcode/Reader/BitReader.cpp
@@ -11,6 +11,7 @@
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Support/MemoryBuffer.h"
#include <string>
+#include <cstring>
using namespace llvm;
diff --git a/lib/CodeGen/MachOWriter.cpp b/lib/CodeGen/MachOWriter.cpp
index 92b3eb4311c..d163df3c4fe 100644
--- a/lib/CodeGen/MachOWriter.cpp
+++ b/lib/CodeGen/MachOWriter.cpp
@@ -38,6 +38,7 @@
#include "llvm/Support/OutputBuffer.h"
#include "llvm/Support/Streams.h"
#include <algorithm>
+#include <cstring>
using namespace llvm;
/// AddMachOWriter - Concrete function to add the Mach-O writer to the function
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp
index 9799f508569..5e883917129 100644
--- a/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -26,7 +26,8 @@
#include "llvm/System/DynamicLibrary.h"
#include "llvm/System/Host.h"
#include "llvm/Target/TargetData.h"
-#include <math.h>
+#include <cmath>
+#include <cstring>
using namespace llvm;
STATISTIC(NumInitBytes, "Number of bytes of global vars initialized");
diff --git a/lib/ExecutionEngine/ExecutionEngineBindings.cpp b/lib/ExecutionEngine/ExecutionEngineBindings.cpp
index 26e0d414166..20ee78044cf 100644
--- a/lib/ExecutionEngine/ExecutionEngineBindings.cpp
+++ b/lib/ExecutionEngine/ExecutionEngineBindings.cpp
@@ -15,6 +15,7 @@
#include "llvm-c/ExecutionEngine.h"
#include "llvm/ExecutionEngine/GenericValue.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
+#include <cstring>
using namespace llvm;
diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp
index f47f12853cf..3463edc5c45 100644
--- a/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -23,8 +23,9 @@
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/MathExtras.h"
-#include <cmath>
#include <algorithm>
+#include <cmath>
+#include <cstring>
using namespace llvm;
STATISTIC(NumDynamicInsts, "Number of dynamic instructions executed");
diff --git a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
index c6dde951499..b85f270f9e0 100644
--- a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
+++ b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
@@ -29,6 +29,7 @@
#include <csignal>
#include <map>
#include <cmath>
+#include <cstring>
#ifdef __linux__
#include <cxxabi.h>
diff --git a/lib/ExecutionEngine/Interpreter/Interpreter.cpp b/lib/ExecutionEngine/Interpreter/Interpreter.cpp
index 60e2897b819..5d7f9018542 100644
--- a/lib/ExecutionEngine/Interpreter/Interpreter.cpp
+++ b/lib/ExecutionEngine/Interpreter/Interpreter.cpp
@@ -18,6 +18,7 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/ModuleProvider.h"
+#include <cstring>
using namespace llvm;
static struct RegisterInterp {
diff --git a/lib/ExecutionEngine/JIT/JITMemoryManager.cpp b/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
index 0bf42b80994..d5b2696269d 100644
--- a/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
+++ b/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
@@ -17,6 +17,8 @@
#include <map>
#include <vector>
#include <cassert>
+#include <cstdlib>
+#include <cstring>
using namespace llvm;
diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp
index 804af957770..c70ed0da0cc 100644
--- a/lib/Support/CommandLine.cpp
+++ b/lib/Support/CommandLine.cpp
@@ -29,6 +29,7 @@
#include <cstdlib>
#include <cerrno>
#include <cstring>
+#include <climits>
using namespace llvm;
using namespace cl;
diff --git a/lib/Support/FileUtilities.cpp b/lib/Support/FileUtilities.cpp
index 42083e46bd2..cde08d188ca 100644
--- a/lib/Support/FileUtilities.cpp
+++ b/lib/Support/FileUtilities.cpp
@@ -16,6 +16,7 @@
#include "llvm/System/Path.h"
#include "llvm/System/MappedFile.h"
#include "llvm/ADT/StringExtras.h"
+#include <cstdlib>
#include <cstring>
#include <cctype>
using namespace llvm;
diff --git a/lib/Support/FoldingSet.cpp b/lib/Support/FoldingSet.cpp
index 97d1f0d1689..bf50ed43dfe 100644
--- a/lib/Support/FoldingSet.cpp
+++ b/lib/Support/FoldingSet.cpp
@@ -17,6 +17,7 @@
#include "llvm/ADT/FoldingSet.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
+#include <cstring>
using namespace llvm;
//===----------------------------------------------------------------------===//
diff --git a/lib/Support/Statistic.cpp b/lib/Support/Statistic.cpp
index 10f13f554c0..e500b55f5f5 100644
--- a/lib/Support/Statistic.cpp
+++ b/lib/Support/Statistic.cpp
@@ -28,6 +28,7 @@
#include "llvm/ADT/StringExtras.h"
#include <algorithm>
#include <ostream>
+#include <cstring>
using namespace llvm;
// GetLibSupportInfoOutputFile - Return a file stream to print our output on.
diff --git a/lib/Support/StringExtras.cpp b/lib/Support/StringExtras.cpp
index ac17696dd78..1fae4fae488 100644
--- a/lib/Support/StringExtras.cpp
+++ b/lib/Support/StringExtras.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/ADT/StringExtras.h"
+#include <cstring>
using namespace llvm;
/// getToken - This function extracts one token from source, ignoring any
diff --git a/lib/Target/Sparc/SparcAsmPrinter.cpp b/lib/Target/Sparc/SparcAsmPrinter.cpp
index b95acddc738..cbbf4126dd8 100644
--- a/lib/Target/Sparc/SparcAsmPrinter.cpp
+++ b/lib/Target/Sparc/SparcAsmPrinter.cpp
@@ -31,6 +31,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/MathExtras.h"
#include <cctype>
+#include <cstring>
using namespace llvm;
STATISTIC(EmittedInsts, "Number of machine instrs printed");
diff --git a/lib/Target/X86/X86JITInfo.cpp b/lib/Target/X86/X86JITInfo.cpp
index de7a8e45fbd..cb16c6c26b9 100644
--- a/lib/Target/X86/X86JITInfo.cpp
+++ b/lib/Target/X86/X86JITInfo.cpp
@@ -18,6 +18,7 @@
#include "llvm/CodeGen/MachineCodeEmitter.h"
#include "llvm/Config/alloca.h"
#include <cstdlib>
+#include <cstring>
using namespace llvm;
#ifdef _MSC_VER
diff --git a/lib/Transforms/IPO/SimplifyLibCalls.cpp b/lib/Transforms/IPO/SimplifyLibCalls.cpp
index f5252a02f1b..a8f5a952bf2 100644
--- a/lib/Transforms/IPO/SimplifyLibCalls.cpp
+++ b/lib/Transforms/IPO/SimplifyLibCalls.cpp
@@ -30,6 +30,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Transforms/IPO.h"
+#include <cstring>
using namespace llvm;
/// This statistic keeps track of the total number of library calls that have
diff --git a/lib/Transforms/Scalar/LoopUnroll.cpp b/lib/Transforms/Scalar/LoopUnroll.cpp
index b514156a1af..2140b22f2ff 100644
--- a/lib/Transforms/Scalar/LoopUnroll.cpp
+++ b/lib/Transforms/Scalar/LoopUnroll.cpp
@@ -36,8 +36,9 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/IntrinsicInst.h"
-#include <cstdio>
#include <algorithm>
+#include <climits>
+#include <cstdio>
using namespace llvm;
STATISTIC(NumCompletelyUnrolled, "Number of loops completely unrolled");
diff --git a/lib/VMCore/AutoUpgrade.cpp b/lib/VMCore/AutoUpgrade.cpp
index 4d0eb1ca0b0..53e97f4807f 100644
--- a/lib/VMCore/AutoUpgrade.cpp
+++ b/lib/VMCore/AutoUpgrade.cpp
@@ -18,6 +18,7 @@
#include "llvm/Instructions.h"
#include "llvm/ParameterAttributes.h"
#include "llvm/Intrinsics.h"
+#include <cstring>
using namespace llvm;
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp
index 06dc9dc89f7..451190fc94a 100644
--- a/lib/VMCore/ConstantFold.cpp
+++ b/lib/VMCore/ConstantFold.cpp
@@ -660,25 +660,28 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
case Instruction::Xor:
return ConstantInt::get(C1V ^ C2V);
case Instruction::Shl:
- if (uint32_t shiftAmt = C2V.getZExtValue())
+ if (uint32_t shiftAmt = C2V.getZExtValue()) {
if (shiftAmt < C1V.getBitWidth())
return ConstantInt::get(C1V.shl(shiftAmt));
else
return UndefValue::get(C1->getType()); // too big shift is undef
+ }
return const_cast<ConstantInt*>(CI1); // Zero shift is identity
case Instruction::LShr:
- if (uint32_t shiftAmt = C2V.getZExtValue())
+ if (uint32_t shiftAmt = C2V.getZExtValue()) {
if (shiftAmt < C1V.getBitWidth())
return ConstantInt::get(C1V.lshr(shiftAmt));
else
return UndefValue::get(C1->getType()); // too big shift is undef
+ }
return const_cast<ConstantInt*>(CI1); // Zero shift is identity
case Instruction::AShr:
- if (uint32_t shiftAmt = C2V.getZExtValue())
+ if (uint32_t shiftAmt = C2V.getZExtValue()) {
if (shiftAmt < C1V.getBitWidth())
return ConstantInt::get(C1V.ashr(shiftAmt));
else
return UndefValue::get(C1->getType()); // too big shift is undef
+ }
return const_cast<ConstantInt*>(CI1); // Zero shift is identity
}
}
@@ -1083,18 +1086,20 @@ static ICmpInst::Predicate evaluateICmpRelation(const Constant *V1,
// Ok, we ran out of things they have in common. If any leftovers
// are non-zero then we have a difference, otherwise we are equal.
for (; i < CE1->getNumOperands(); ++i)
- if (!CE1->getOperand(i)->isNullValue())
+ if (!CE1->getOperand(i)->isNullValue()) {
if (isa<ConstantInt>(CE1->getOperand(i)))
return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
else
return ICmpInst::BAD_ICMP_PREDICATE; // Might be equal.
+ }
for (; i < CE2->getNumOperands(); ++i)
- if (!CE2->getOperand(i)->isNullValue())
+ if (!CE2->getOperand(i)->isNullValue()) {
if (isa<ConstantInt>(CE2->getOperand(i)))
return isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
else
return ICmpInst::BAD_ICMP_PREDICATE; // Might be equal.
+ }
return ICmpInst::ICMP_EQ;
}
}
@@ -1123,20 +1128,22 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
if (C1->isNullValue()) {
if (const GlobalValue *GV = dyn_cast<GlobalValue>(C2))
// Don't try to evaluate aliases. External weak GV can be null.
- if (!isa<GlobalAlias>(GV) && !GV->hasExternalWeakLinkage())
+ if (!isa<GlobalAlias>(GV) && !GV->hasExternalWeakLinkage()) {
if (pred == ICmpInst::ICMP_EQ)
return ConstantInt::getFalse();
else if (pred == ICmpInst::ICMP_NE)
return ConstantInt::getTrue();
+ }
// icmp eq/ne(GV,null) -> false/true
} else if (C2->isNullValue()) {
if (const GlobalValue *GV = dyn_cast<GlobalValue>(C1))
// Don't try to evaluate aliases. External weak GV can be null.
- if (!isa<GlobalAlias>(GV) && !GV->hasExternalWeakLinkage())
+ if (!isa<GlobalAlias>(GV) && !GV->hasExternalWeakLinkage()) {
if (pred == ICmpInst::ICMP_EQ)
return ConstantInt::getFalse();
else if (pred == ICmpInst::ICMP_NE)
return ConstantInt::getTrue();
+ }
}
if (isa<ConstantInt>(C1) && isa<ConstantInt>(C2)) {
diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp
index 0c913ffbf73..c159bbc2f76 100644
--- a/lib/VMCore/Core.cpp
+++ b/lib/VMCore/Core.cpp
@@ -22,6 +22,7 @@
#include "llvm/Support/MemoryBuffer.h"
#include <cassert>
#include <cstdlib>
+#include <cstring>
using namespace llvm;
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 959ac9b6174..65bc1830e5f 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -186,11 +186,12 @@ void PHINode::resizeOperands(unsigned NumOps) {
///
Value *PHINode::hasConstantValue(bool AllowNonDominatingInstruction) const {
// If the PHI node only has one incoming value, eliminate the PHI node...
- if (getNumIncomingValues() == 1)
+ if (getNumIncomingValues() == 1) {
if (getIncomingValue(0) != this) // not X = phi X
return getIncomingValue(0);
else
return UndefValue::get(getType()); // Self cycle is dead.
+ }
// Otherwise if all of the incoming values are the same for the PHI, replace
// the PHI node with the incoming value.
@@ -198,13 +199,14 @@ Value *PHINode::hasConstantValue(bool AllowNonDominatingInstruction) const {
Value *InVal = 0;
bool HasUndefInput = false;
for (unsigned i = 0, e = getNumIncomingValues(); i != e; ++i)
- if (isa<UndefValue>(getIncomingValue(i)))
+ if (isa<UndefValue>(getIncomingValue(i))) {
HasUndefInput = true;
- else if (getIncomingValue(i) != this) // Not the PHI node itself...
+ } else if (getIncomingValue(i) != this) { // Not the PHI node itself...
if (InVal && getIncomingValue(i) != InVal)
return 0; // Not the same, bail out.
else
InVal = getIncomingValue(i);
+ }
// The only case that could cause InVal to be null is if we have a PHI node
// that only has entries for itself. In this case, there is no entry into the
@@ -451,8 +453,8 @@ void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
cast<FunctionType>(cast<PointerType>(Fn->getType())->getElementType());
FTy = FTy; // silence warning.
- assert((NumArgs == FTy->getNumParams()) ||
- (FTy->isVarArg() && NumArgs > FTy->getNumParams()) &&
+ assert(((NumArgs == FTy->getNumParams()) ||
+ (FTy->isVarArg() && NumArgs > FTy->getNumParams())) &&
"Calling a function with bad signature");
for (unsigned i = 0, e = NumArgs; i != e; i++) {
@@ -1037,12 +1039,13 @@ const Type* GetElementPtrInst::getIndexedType(const Type *Ptr,
if (!isa<PointerType>(Ptr)) return 0; // Type isn't a pointer type!
// Handle the special case of the empty set index set...
- if (NumIdx == 0)
+ if (NumIdx == 0) {
if (AllowCompositeLeaf ||
cast<PointerType>(Ptr)->getElementType()->isFirstClassType())
return cast<PointerType>(Ptr)->getElementType();
else
return 0;
+ }
unsigned CurIdx = 0;
while (const CompositeType *CT = dyn_cast<CompositeType>(Ptr)) {
@@ -2329,7 +2332,7 @@ CmpInst::CmpInst(OtherOps op, unsigned short predicate, Value *LHS, Value *RHS,
assert(Op0Ty == Op1Ty &&
"Both operands to ICmp instruction are not of the same type!");
// Check that the operands are the right type
- assert(Op0Ty->isInteger() || isa<PointerType>(Op0Ty) &&
+ assert((Op0Ty->isInteger() || isa<PointerType>(Op0Ty)) &&
"Invalid operand types for ICmp instruction");
return;
}
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp
index 54ea5b7502f..7b9d7f02b37 100644
--- a/lib/VMCore/Value.cpp
+++ b/lib/VMCore/Value.cpp
@@ -307,7 +307,7 @@ void Value::replaceAllUsesWith(Value *New) {
void User::replaceUsesOfWith(Value *From, Value *To) {
if (From == To) return; // Duh what?
- assert(!isa<Constant>(this) || isa<GlobalValue>(this) &&
+ assert((!isa<Constant>(this) || isa<GlobalValue>(this)) &&
"Cannot call User::replaceUsesofWith on a constant!");
for (unsigned i = 0, E = getNumOperands(); i != E; ++i)
diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp
index 9d0d93fd830..6657c7c7fd2 100644
--- a/tools/llvm-ld/llvm-ld.cpp
+++ b/tools/llvm-ld/llvm-ld.cpp
@@ -38,6 +38,7 @@
#include "llvm/System/Signals.h"
#include <fstream>
#include <memory>
+#include <cstring>
using namespace llvm;
// Input/Output Options
diff --git a/tools/llvm-upgrade/UpgradeInternals.h b/tools/llvm-upgrade/UpgradeInternals.h
index 199e5cfbb23..c3d816bc13b 100644
--- a/tools/llvm-upgrade/UpgradeInternals.h
+++ b/tools/llvm-upgrade/UpgradeInternals.h
@@ -22,7 +22,7 @@
#include "llvm/ADT/StringExtras.h"
#include <list>
#include <iostream>
-
+#include <cstring>
// Global variables exported from the lexer.
extern int yydebug;
diff --git a/tools/llvmc/llvmc.cpp b/tools/llvmc/llvmc.cpp
index cf3bc09fb9b..2bb40692479 100644
--- a/tools/llvmc/llvmc.cpp
+++ b/tools/llvmc/llvmc.cpp
@@ -21,6 +21,7 @@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/System/Signals.h"
#include <iostream>
+#include <cstring>
using namespace llvm;
//===----------------------------------------------------------------------===//
diff --git a/utils/PerfectShuffle/PerfectShuffle.cpp b/utils/PerfectShuffle/PerfectShuffle.cpp
index e7b9421a589..26c4cf44c6e 100644
--- a/utils/PerfectShuffle/PerfectShuffle.cpp
+++ b/utils/PerfectShuffle/PerfectShuffle.cpp
@@ -17,7 +17,7 @@
#include <iostream>
#include <vector>
#include <cassert>
-
+#include <cstdlib>
struct Operator;
// Masks are 4-nibble hex numbers. Values 0-7 in any nibble means that it takes
diff --git a/utils/TableGen/AsmWriterEmitter.cpp b/utils/TableGen/AsmWriterEmitter.cpp
index 07ef2e5c8d0..5a24b26422e 100644
--- a/utils/TableGen/AsmWriterEmitter.cpp
+++ b/utils/TableGen/AsmWriterEmitter.cpp
@@ -242,11 +242,12 @@ unsigned AsmWriterInst::MatchesAllButOneOp(const AsmWriterInst &Other)const{
unsigned MismatchOperand = ~0U;
for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
- if (Operands[i] != Other.Operands[i])
+ if (Operands[i] != Other.Operands[i]) {
if (MismatchOperand != ~0U) // Already have one mismatch?
return ~1U;
else
MismatchOperand = i;
+ }
}
return MismatchOperand;
}
diff --git a/utils/TableGen/CodeGenDAGPatterns.cpp b/utils/TableGen/CodeGenDAGPatterns.cpp
index ddfaaac5782..0faaa7284ac 100644
--- a/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -1342,14 +1342,14 @@ void CodeGenDAGPatterns::ParseDefaultOperands() {
while (TPN->ApplyTypeConstraints(P, false))
/* Resolve all types */;
- if (TPN->ContainsUnresolvedType())
+ if (TPN->ContainsUnresolvedType()) {
if (iter == 0)
throw "Value #" + utostr(i) + " of PredicateOperand '" +
DefaultOps[iter][i]->getName() + "' doesn't have a concrete type!";
else
throw "Value #" + utostr(i) + " of OptionalDefOperand '" +
DefaultOps[iter][i]->getName() + "' doesn't have a concrete type!";
-
+ }
DefaultOpInfo.DefaultOps.push_back(TPN);
}
diff --git a/utils/TableGen/CodeGenRegisters.h b/utils/TableGen/CodeGenRegisters.h
index 4efae7842b0..0f1b501fc14 100644
--- a/utils/TableGen/CodeGenRegisters.h
+++ b/utils/TableGen/CodeGenRegisters.h
@@ -15,9 +15,10 @@
#ifndef CODEGEN_REGISTERS_H
#define CODEGEN_REGISTERS_H
+#include "llvm/CodeGen/ValueTypes.h"
#include <string>
#include <vector>
-#include "llvm/CodeGen/ValueTypes.h"
+#include <cstdlib>
namespace llvm {
class Record;
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index bdf6b64205d..6f562fad592 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -1123,7 +1123,7 @@ public:
Code += "), 0";
emitCode(Code2 + Code + ");");
- if (NodeHasChain)
+ if (NodeHasChain) {
// Remember which op produces the chain.
if (!isRoot)
emitCode(ChainName + " = SDOperand(" + NodeName +
@@ -1131,6 +1131,7 @@ public:
else
emitCode(ChainName + " = SDOperand(" + NodeName +
", " + utostr(NumResults+NumDstRegs) + ");");
+ }
if (!isRoot) {
NodeOps.push_back("Tmp" + utostr(ResNo));
diff --git a/utils/TableGen/TGLexer.cpp b/utils/TableGen/TGLexer.cpp
index 9fa696e8cbe..2af35b05d6d 100644
--- a/utils/TableGen/TGLexer.cpp
+++ b/utils/TableGen/TGLexer.cpp
@@ -17,6 +17,8 @@
#include <ostream>
#include "llvm/Config/config.h"
#include <cctype>
+#include <cstdlib>
+#include <cstring>
using namespace llvm;
TGLexer::TGLexer(MemoryBuffer *StartBuf) : CurLineNo(1), CurBuf(StartBuf) {