1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

correct const-ness with auto and dyn_cast

1. Use const with autos.
2. Don't bother with explicit const in cast ops because they do it automagically.

Thanks, David B. / Aaron B. / Reid K.

llvm-svn: 219817
This commit is contained in:
Sanjay Patel 2014-10-15 17:45:13 +00:00
parent 9eb64770d5
commit 777983df2c

View File

@ -710,15 +710,15 @@ static void WriteModuleInfo(const Module *M, const ValueEnumerator &VE,
static uint64_t GetOptimizationFlags(const Value *V) {
uint64_t Flags = 0;
if (auto *OBO = dyn_cast<OverflowingBinaryOperator>(V)) {
if (const auto *OBO = dyn_cast<OverflowingBinaryOperator>(V)) {
if (OBO->hasNoSignedWrap())
Flags |= 1 << bitc::OBO_NO_SIGNED_WRAP;
if (OBO->hasNoUnsignedWrap())
Flags |= 1 << bitc::OBO_NO_UNSIGNED_WRAP;
} else if (auto *PEO = dyn_cast<PossiblyExactOperator>(V)) {
} else if (const auto *PEO = dyn_cast<PossiblyExactOperator>(V)) {
if (PEO->isExact())
Flags |= 1 << bitc::PEO_EXACT;
} else if (auto *FPMO = dyn_cast<const FPMathOperator>(V)) {
} else if (const auto *FPMO = dyn_cast<FPMathOperator>(V)) {
if (FPMO->hasUnsafeAlgebra())
Flags |= FastMathFlags::UnsafeAlgebra;
if (FPMO->hasNoNaNs())