[llvm] [InstCombine] FP fold, cond ? x : -x == 0 into x == 0 #85250 (PR #85673)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 25 02:46:25 PDT 2024
================
@@ -7972,6 +7972,13 @@ Instruction *InstCombinerImpl::visitFCmpInst(FCmpInst &I) {
Constant *RHSC;
if (match(Op0, m_Instruction(LHSI)) && match(Op1, m_Constant(RHSC))) {
switch (LHSI->getOpcode()) {
+ case Instruction::Select:
+ if (FCmpInst::isEquality(Pred) && match(RHSC, m_AnyZeroFP()) &&
----------------
jayfoad wrote:
```suggestion
// fcmp eq (cond ? x : -x), 0 --> fcmp eq x, 0
if (FCmpInst::isEquality(Pred) && match(RHSC, m_AnyZeroFP()) &&
```
https://github.com/llvm/llvm-project/pull/85673
More information about the llvm-commits
mailing list