[PATCH] D53205: [FPEnv][NFCI] Convert more BinaryOperator::isFNeg(...) to m_FNeg(...)
Cameron McInally via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 19 11:32:54 PDT 2018
cameron.mcinally added a comment.
Just thinking aloud. I really don't have enough experience with this framework to say for sure...
This hasNoSignedZeros(...) function is pretty rigid:
bool Instruction::hasNoSignedZeros() const {
assert(isa<FPMathOperator>(this) && "getting fast-math flag on invalid op");
return cast<FPMathOperator>(this)->hasNoSignedZeros();
}
So this will assert if the class isn't an FPMathOperator. Maybe this function (and friends) should be relaxed to return false if it's not an FPMathOperator?
That way our explicit code wouldn't be so verbose. E,g.:
if (!BinaryOperator::isNot(I) && !BinaryOperator::isNeg(I) &&
!(match(I, m_FNeg(m_Value()))) &&
!(I->hasNoSignedZeros() && match(I, m_FNegNSZ(m_Value()))))
++Rank;
*Note: that could probably be cleaned up more. Just a rough example.
Repository:
rL LLVM
https://reviews.llvm.org/D53205
More information about the llvm-commits
mailing list