[llvm] r270370 - use 'auto' with 'dyn_cast'; fix formatting; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sun May 22 09:07:28 PDT 2016
Author: spatel
Date: Sun May 22 11:07:20 2016
New Revision: 270370
URL: http://llvm.org/viewvc/llvm-project?rev=270370&view=rev
Log:
use 'auto' with 'dyn_cast'; fix formatting; NFC
Modified:
llvm/trunk/lib/Analysis/ValueTracking.cpp
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=270370&r1=270369&r2=270370&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Sun May 22 11:07:20 2016
@@ -1653,8 +1653,7 @@ static bool isGEPKnownNonNull(GEPOperato
/// 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(M
/// 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 D
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 V
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 V
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.
More information about the llvm-commits
mailing list