diff options
author | Sanjay Patel <spatel@rotateright.com> | 2016-05-22 16:07:20 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2016-05-22 16:07:20 +0000 |
commit | 8ec7e7c21606dc4935dd74119ac517ad52819c87 (patch) | |
tree | 525e5557dc85fe91811220bd542f328fd795f748 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | e2e89ef93604fefb1a145d26e12f43da7a5f24d2 (diff) | |
download | bcm5719-llvm-8ec7e7c21606dc4935dd74119ac517ad52819c87.tar.gz bcm5719-llvm-8ec7e7c21606dc4935dd74119ac517ad52819c87.zip |
use 'auto' with 'dyn_cast'; fix formatting; NFC
llvm-svn: 270370
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 38853478c06..3293f30f8a0 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -1653,8 +1653,7 @@ static bool isGEPKnownNonNull(GEPOperator *GEP, unsigned Depth, /// Does the 'Range' metadata (which must be a valid MD_range operand list) /// ensure that the value it's attached to is never Value? 'RangeType' is /// is the type of the value described by the range. -static bool rangeMetadataExcludesValue(MDNode* Ranges, - const APInt& Value) { +static bool rangeMetadataExcludesValue(MDNode* Ranges, const APInt& Value) { const unsigned NumRanges = Ranges->getNumOperands() / 2; assert(NumRanges >= 1); for (unsigned i = 0; i < NumRanges; ++i) { @@ -1674,7 +1673,7 @@ static bool rangeMetadataExcludesValue(MDNode* Ranges, /// defined. Supports values with integer or pointer type and vectors of /// integers. bool isKnownNonZero(Value *V, unsigned Depth, const Query &Q) { - if (Constant *C = dyn_cast<Constant>(V)) { + if (auto *C = dyn_cast<Constant>(V)) { if (C->isNullValue()) return false; if (isa<ConstantInt>(C)) @@ -1684,11 +1683,11 @@ bool isKnownNonZero(Value *V, unsigned Depth, const Query &Q) { return false; } - if (Instruction* I = dyn_cast<Instruction>(V)) { + if (auto *I = dyn_cast<Instruction>(V)) { if (MDNode *Ranges = I->getMetadata(LLVMContext::MD_range)) { // If the possible ranges don't contain zero, then the value is // definitely non-zero. - if (IntegerType* Ty = dyn_cast<IntegerType>(V->getType())) { + if (auto *Ty = dyn_cast<IntegerType>(V->getType())) { const APInt ZeroValue(Ty->getBitWidth(), 0); if (rangeMetadataExcludesValue(Ranges, ZeroValue)) return true; @@ -2816,7 +2815,7 @@ bool llvm::getConstantStringInfo(const Value *V, StringRef &Str, if (!GV || !GV->isConstant() || !GV->hasDefinitiveInitializer()) return false; - // Handle the all-zeros case + // Handle the all-zeros case. if (GV->getInitializer()->isNullValue()) { // This is a degenerate case. The initializer is constant zero so the // length of the string must be zero. @@ -2824,13 +2823,12 @@ bool llvm::getConstantStringInfo(const Value *V, StringRef &Str, return true; } - // Must be a Constant Array - const ConstantDataArray *Array = - dyn_cast<ConstantDataArray>(GV->getInitializer()); + // This must be a ConstantDataArray. + const auto *Array = dyn_cast<ConstantDataArray>(GV->getInitializer()); if (!Array || !Array->isString()) return false; - // Get the number of elements in the array + // Get the number of elements in the array. uint64_t NumElts = Array->getType()->getArrayNumElements(); // Start out with the entire array in the StringRef. |