mirror of
https://github.com/RPCS3/llvm.git
synced 2025-03-02 15:45:44 +00:00
[ValueTracking] use 'auto' with 'dyn_cast'; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318058 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
65f52bf60e
commit
0e1d4ee93e
@ -2593,36 +2593,38 @@ Intrinsic::ID llvm::getIntrinsicForCallSite(ImmutableCallSite ICS,
|
||||
/// 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user