mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-28 06:00:28 +00:00
use 'auto' with 'dyn_cast'; fix formatting; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270370 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
56708009f1
commit
5afdcbe0c7
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user