[llvm] [InstCombine] Fold fcmp ogt (x - y), 0 into fcmp ogt x, y #85245 (PR #85506)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 22 08:10:35 PDT 2024
================
@@ -7972,6 +7972,11 @@ Instruction *InstCombinerImpl::visitFCmpInst(FCmpInst &I) {
Constant *RHSC;
if (match(Op0, m_Instruction(LHSI)) && match(Op1, m_Constant(RHSC))) {
switch (LHSI->getOpcode()) {
+ case Instruction::FSub:
+ if (Pred == FCmpInst::FCMP_OGT && match(RHSC, m_PosZeroFP()) &&
----------------
arsenm wrote:
https://github.com/llvm/llvm-project/blob/6f44bb7717897191be25aa01161831c67cdf5b84/llvm/include/llvm/Analysis/ValueTracking.h#L511 is the helper I was thinking of. It's 1 level below isKnownNeverInfinity, but can be used the same way
https://github.com/llvm/llvm-project/pull/85506
More information about the llvm-commits
mailing list