[llvm] r318058 - [ValueTracking] use 'auto' with 'dyn_cast'; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 13 09:56:23 PST 2017
Author: spatel
Date: Mon Nov 13 09:56:23 2017
New Revision: 318058
URL: http://llvm.org/viewvc/llvm-project?rev=318058&view=rev
Log:
[ValueTracking] use 'auto' with 'dyn_cast'; 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=318058&r1=318057&r2=318058&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Mon Nov 13 09:56:23 2017
@@ -2593,36 +2593,38 @@ Intrinsic::ID llvm::getIntrinsicForCallS
/// rounding modes!
bool llvm::CannotBeNegativeZero(const Value *V, const TargetLibraryInfo *TLI,
unsigned Depth) {
- if (const ConstantFP *CFP = dyn_cast<ConstantFP>(V))
+ if (auto *CFP = dyn_cast<ConstantFP>(V))
return !CFP->getValueAPF().isNegZero();
+ // Limit search depth.
if (Depth == MaxDepth)
- return false; // Limit search depth.
+ return false;
- const Operator *I = dyn_cast<Operator>(V);
- if (!I) return false;
+ auto *Op = dyn_cast<Operator>(V);
+ if (!Op)
+ return false;
- // Check if the nsz fast-math flag is set
- if (const FPMathOperator *FPO = dyn_cast<FPMathOperator>(I))
+ // Check if the nsz fast-math flag is set.
+ if (auto *FPO = dyn_cast<FPMathOperator>(Op))
if (FPO->hasNoSignedZeros())
return true;
// (fadd x, 0.0) is guaranteed to return +0.0, not -0.0.
- if (match(I, m_FAdd(m_Value(), m_Zero())))
+ if (match(Op, m_FAdd(m_Value(), m_Zero())))
return true;
// sitofp and uitofp turn into +0.0 for zero.
- if (isa<SIToFPInst>(I) || isa<UIToFPInst>(I))
+ if (isa<SIToFPInst>(Op) || isa<UIToFPInst>(Op))
return true;
- if (const CallInst *CI = dyn_cast<CallInst>(I)) {
- Intrinsic::ID IID = getIntrinsicForCallSite(CI, TLI);
+ if (auto *Call = dyn_cast<CallInst>(Op)) {
+ Intrinsic::ID IID = getIntrinsicForCallSite(Call, TLI);
switch (IID) {
default:
break;
// sqrt(-0.0) = -0.0, no other negative results are possible.
case Intrinsic::sqrt:
- return CannotBeNegativeZero(CI->getArgOperand(0), TLI, Depth + 1);
+ return CannotBeNegativeZero(Call->getArgOperand(0), TLI, Depth + 1);
// fabs(x) != -0.0
case Intrinsic::fabs:
return true;
More information about the llvm-commits
mailing list