[llvm-branch-commits] [llvm] InstCombine: Improve single-use fneg(fabs(x)) SimplifyDemandedFPClass handling (PR #176360)

Yingwei Zheng via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jan 16 07:34:04 PST 2026


================
@@ -2200,6 +2224,38 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Instruction *I,
 
   switch (I->getOpcode()) {
   case Instruction::FNeg: {
+    // Special case fneg(fabs(x))
+
+    Value *FNegSrc = I->getOperand(0);
+    Value *FNegFAbsSrc;
+    if (match(FNegSrc, m_FAbs(m_Value(FNegFAbsSrc)))) {
----------------
dtcxzyw wrote:

Please add some tests with multi-use fabs. I guess this shares the same issue with #176122.

https://github.com/llvm/llvm-project/pull/176360


More information about the llvm-branch-commits mailing list