[llvm-branch-commits] [llvm] InstCombine: Handle fsub in SimplifyDemandedFPClass (PR #175852)

2026-01-15 Thread Matt Arsenault via llvm-branch-commits


@@ -2157,11 +2162,13 @@ Value 
*InstCombinerImpl::SimplifyDemandedUseFPClass(Instruction *I,
 }
 
 // With nnan: X + {+/-}Inf --> {+/-}Inf
-if (KnownRHS.isKnownAlways(fcInf | fcNan) &&
-KnownLHS.isKnownNever(fcNan))
+if (I->getOpcode() == Instruction::FAdd &&
+KnownRHS.isKnownAlways(fcInf | fcNan) && KnownLHS.isKnownNever(fcNan)) 
{

arsenm wrote:

Broken for fadd, moved to https://github.com/llvm/llvm-project/pull/176204

https://github.com/llvm/llvm-project/pull/175852
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] InstCombine: Handle fsub in SimplifyDemandedFPClass (PR #175852)

2026-01-15 Thread Yingwei Zheng via llvm-branch-commits


@@ -2157,11 +2162,13 @@ Value 
*InstCombinerImpl::SimplifyDemandedUseFPClass(Instruction *I,
 }
 
 // With nnan: X + {+/-}Inf --> {+/-}Inf
-if (KnownRHS.isKnownAlways(fcInf | fcNan) &&
-KnownLHS.isKnownNever(fcNan))
+if (I->getOpcode() == Instruction::FAdd &&
+KnownRHS.isKnownAlways(fcInf | fcNan) && KnownLHS.isKnownNever(fcNan)) 
{

dtcxzyw wrote:

inf + -inf -> nan

https://github.com/llvm/llvm-project/pull/175852
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] InstCombine: Handle fsub in SimplifyDemandedFPClass (PR #175852)

2026-01-15 Thread Yingwei Zheng via llvm-branch-commits


@@ -2157,11 +2162,13 @@ Value 
*InstCombinerImpl::SimplifyDemandedUseFPClass(Instruction *I,
 }
 
 // With nnan: X + {+/-}Inf --> {+/-}Inf
-if (KnownRHS.isKnownAlways(fcInf | fcNan) &&
-KnownLHS.isKnownNever(fcNan))
+if (I->getOpcode() == Instruction::FAdd &&
+KnownRHS.isKnownAlways(fcInf | fcNan) && KnownLHS.isKnownNever(fcNan)) 
{
   return I->getOperand(1);
+}
 
 // With nnan: {+/-}Inf + X --> {+/-}Inf
+// With nnan: {+/-}Inf - X --> {+/-}Inf
 if (KnownLHS.isKnownAlways(fcInf | fcNan) &&

dtcxzyw wrote:

ResultNotNan && 

https://github.com/llvm/llvm-project/pull/175852
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] InstCombine: Handle fsub in SimplifyDemandedFPClass (PR #175852)

2026-01-15 Thread Yingwei Zheng via llvm-branch-commits


@@ -2157,11 +2162,13 @@ Value 
*InstCombinerImpl::SimplifyDemandedUseFPClass(Instruction *I,
 }
 
 // With nnan: X + {+/-}Inf --> {+/-}Inf
-if (KnownRHS.isKnownAlways(fcInf | fcNan) &&
-KnownLHS.isKnownNever(fcNan))
+if (I->getOpcode() == Instruction::FAdd &&
+KnownRHS.isKnownAlways(fcInf | fcNan) && KnownLHS.isKnownNever(fcNan)) 
{

dtcxzyw wrote:

```suggestion
ResultNotNan && KnownRHS.isKnownAlways(fcInf | fcNan) && 
KnownLHS.isKnownNever(fcNan)) {
```

https://github.com/llvm/llvm-project/pull/175852
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] InstCombine: Handle fsub in SimplifyDemandedFPClass (PR #175852)

2026-01-14 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175852

>From d96ba8b2e5a122703515cb499974cb82d9828214 Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 5 Jan 2026 14:20:21 +0100
Subject: [PATCH 1/2] InstCombine: Handle fsub in SimplifyDemandedFPClass

alive2 fails on some of the tests, but this is due to existing
folds in instsimplify and https://github.com/AliveToolkit/alive2/issues/1273
---
 llvm/include/llvm/Support/KnownFPClass.h  |   5 +
 llvm/lib/Analysis/ValueTracking.cpp   |  81 +++
 llvm/lib/Support/KnownFPClass.cpp |  21 +++
 .../InstCombineSimplifyDemanded.cpp   |  15 +-
 .../simplify-demanded-fpclass-fsub.ll | 128 --
 5 files changed, 112 insertions(+), 138 deletions(-)

diff --git a/llvm/include/llvm/Support/KnownFPClass.h 
b/llvm/include/llvm/Support/KnownFPClass.h
index e2b0d20c790a9..010ca6a3e84ec 100644
--- a/llvm/include/llvm/Support/KnownFPClass.h
+++ b/llvm/include/llvm/Support/KnownFPClass.h
@@ -222,6 +222,11 @@ struct KnownFPClass {
   fadd_self(const KnownFPClass &Src,
 DenormalMode Mode = DenormalMode::getDynamic());
 
+  /// Report known values for fsub
+  LLVM_ABI static KnownFPClass
+  fsub(const KnownFPClass &LHS, const KnownFPClass &RHS,
+   DenormalMode Mode = DenormalMode::getDynamic());
+
   /// Report known values for fmul
   LLVM_ABI static KnownFPClass
   fmul(const KnownFPClass &LHS, const KnownFPClass &RHS,
diff --git a/llvm/lib/Analysis/ValueTracking.cpp 
b/llvm/lib/Analysis/ValueTracking.cpp
index ece8425aef698..51fbffd6fd371 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -5524,78 +5524,37 @@ void computeKnownFPClass(const Value *V, const APInt 
&DemandedElts,
 KnownRHS, Q, Depth + 1);
 
 // Special case fadd x, x, which is the canonical form of fmul x, 2.
-bool SelfAdd = Op->getOperand(0) == Op->getOperand(1) &&
-   isGuaranteedNotToBeUndef(Op->getOperand(0), Q.AC, Q.CxtI,
-Q.DT, Depth + 1);
-if (SelfAdd)
+bool Self = Op->getOperand(0) == Op->getOperand(1) &&
+isGuaranteedNotToBeUndef(Op->getOperand(0), Q.AC, Q.CxtI, Q.DT,
+ Depth + 1);
+if (Self)
   KnownLHS = KnownRHS;
 
 if ((WantNaN && KnownRHS.isKnownNeverNaN()) ||
 (WantNegative && KnownRHS.cannotBeOrderedLessThanZero()) ||
 WantNegZero || Opc == Instruction::FSub) {
 
-  if (!SelfAdd) {
-// RHS is canonically cheaper to compute. Skip inspecting the LHS if
-// there's no point.
-computeKnownFPClass(Op->getOperand(0), DemandedElts, InterestedSrcs,
-KnownLHS, Q, Depth + 1);
-  }
-
-  // Adding positive and negative infinity produces NaN.
-  // TODO: Check sign of infinities.
-  if (KnownLHS.isKnownNeverNaN() && KnownRHS.isKnownNeverNaN() &&
-  (KnownLHS.isKnownNeverInfinity() || KnownRHS.isKnownNeverInfinity()))
-Known.knownNot(fcNan);
-
   // FIXME: Context function should always be passed in separately
   const Function *F = cast(Op)->getFunction();
+  const fltSemantics &FltSem =
+  Op->getType()->getScalarType()->getFltSemantics();
+  DenormalMode Mode =
+  F ? F->getDenormalMode(FltSem) : DenormalMode::getDynamic();
 
-  if (Op->getOpcode() == Instruction::FAdd) {
-if (KnownLHS.cannotBeOrderedLessThanZero() &&
-KnownRHS.cannotBeOrderedLessThanZero())
-  Known.knownNot(KnownFPClass::OrderedLessThanZeroMask);
-if (KnownLHS.cannotBeOrderedGreaterThanZero() &&
-KnownRHS.cannotBeOrderedGreaterThanZero())
-  Known.knownNot(KnownFPClass::OrderedGreaterThanZeroMask);
-
-if (!F)
-  break;
-
-const fltSemantics &FltSem =
-Op->getType()->getScalarType()->getFltSemantics();
-DenormalMode Mode = F->getDenormalMode(FltSem);
-
-// Doubling 0 will give the same 0.
-if (SelfAdd && KnownRHS.isKnownNeverLogicalPosZero(Mode) &&
-(Mode.Output == DenormalMode::IEEE ||
- (Mode.Output == DenormalMode::PreserveSign &&
-  KnownRHS.isKnownNeverPosSubnormal()) ||
- (Mode.Output == DenormalMode::PositiveZero &&
-  KnownRHS.isKnownNeverSubnormal(
-  Known.knownNot(fcPosZero);
-
-// (fadd x, 0.0) is guaranteed to return +0.0, not -0.0.
-if ((KnownLHS.isKnownNeverLogicalNegZero(Mode) ||
- KnownRHS.isKnownNeverLogicalNegZero(Mode)) &&
-// Make sure output negative denormal can't flush to -0
-(Mode.Output == DenormalMode::IEEE ||
- Mode.Output == DenormalMode::PositiveZero))
-  Known.knownNot(fcNegZero);
+  if (Self && Opc == Instruction::FAdd) {
+Known = KnownFPClass::fadd_self(KnownLHS, Mode);
   } else 

[llvm-branch-commits] [llvm] InstCombine: Handle fsub in SimplifyDemandedFPClass (PR #175852)

2026-01-14 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/175852

>From d96ba8b2e5a122703515cb499974cb82d9828214 Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 5 Jan 2026 14:20:21 +0100
Subject: [PATCH 1/2] InstCombine: Handle fsub in SimplifyDemandedFPClass

alive2 fails on some of the tests, but this is due to existing
folds in instsimplify and https://github.com/AliveToolkit/alive2/issues/1273
---
 llvm/include/llvm/Support/KnownFPClass.h  |   5 +
 llvm/lib/Analysis/ValueTracking.cpp   |  81 +++
 llvm/lib/Support/KnownFPClass.cpp |  21 +++
 .../InstCombineSimplifyDemanded.cpp   |  15 +-
 .../simplify-demanded-fpclass-fsub.ll | 128 --
 5 files changed, 112 insertions(+), 138 deletions(-)

diff --git a/llvm/include/llvm/Support/KnownFPClass.h 
b/llvm/include/llvm/Support/KnownFPClass.h
index e2b0d20c790a9..010ca6a3e84ec 100644
--- a/llvm/include/llvm/Support/KnownFPClass.h
+++ b/llvm/include/llvm/Support/KnownFPClass.h
@@ -222,6 +222,11 @@ struct KnownFPClass {
   fadd_self(const KnownFPClass &Src,
 DenormalMode Mode = DenormalMode::getDynamic());
 
+  /// Report known values for fsub
+  LLVM_ABI static KnownFPClass
+  fsub(const KnownFPClass &LHS, const KnownFPClass &RHS,
+   DenormalMode Mode = DenormalMode::getDynamic());
+
   /// Report known values for fmul
   LLVM_ABI static KnownFPClass
   fmul(const KnownFPClass &LHS, const KnownFPClass &RHS,
diff --git a/llvm/lib/Analysis/ValueTracking.cpp 
b/llvm/lib/Analysis/ValueTracking.cpp
index ece8425aef698..51fbffd6fd371 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -5524,78 +5524,37 @@ void computeKnownFPClass(const Value *V, const APInt 
&DemandedElts,
 KnownRHS, Q, Depth + 1);
 
 // Special case fadd x, x, which is the canonical form of fmul x, 2.
-bool SelfAdd = Op->getOperand(0) == Op->getOperand(1) &&
-   isGuaranteedNotToBeUndef(Op->getOperand(0), Q.AC, Q.CxtI,
-Q.DT, Depth + 1);
-if (SelfAdd)
+bool Self = Op->getOperand(0) == Op->getOperand(1) &&
+isGuaranteedNotToBeUndef(Op->getOperand(0), Q.AC, Q.CxtI, Q.DT,
+ Depth + 1);
+if (Self)
   KnownLHS = KnownRHS;
 
 if ((WantNaN && KnownRHS.isKnownNeverNaN()) ||
 (WantNegative && KnownRHS.cannotBeOrderedLessThanZero()) ||
 WantNegZero || Opc == Instruction::FSub) {
 
-  if (!SelfAdd) {
-// RHS is canonically cheaper to compute. Skip inspecting the LHS if
-// there's no point.
-computeKnownFPClass(Op->getOperand(0), DemandedElts, InterestedSrcs,
-KnownLHS, Q, Depth + 1);
-  }
-
-  // Adding positive and negative infinity produces NaN.
-  // TODO: Check sign of infinities.
-  if (KnownLHS.isKnownNeverNaN() && KnownRHS.isKnownNeverNaN() &&
-  (KnownLHS.isKnownNeverInfinity() || KnownRHS.isKnownNeverInfinity()))
-Known.knownNot(fcNan);
-
   // FIXME: Context function should always be passed in separately
   const Function *F = cast(Op)->getFunction();
+  const fltSemantics &FltSem =
+  Op->getType()->getScalarType()->getFltSemantics();
+  DenormalMode Mode =
+  F ? F->getDenormalMode(FltSem) : DenormalMode::getDynamic();
 
-  if (Op->getOpcode() == Instruction::FAdd) {
-if (KnownLHS.cannotBeOrderedLessThanZero() &&
-KnownRHS.cannotBeOrderedLessThanZero())
-  Known.knownNot(KnownFPClass::OrderedLessThanZeroMask);
-if (KnownLHS.cannotBeOrderedGreaterThanZero() &&
-KnownRHS.cannotBeOrderedGreaterThanZero())
-  Known.knownNot(KnownFPClass::OrderedGreaterThanZeroMask);
-
-if (!F)
-  break;
-
-const fltSemantics &FltSem =
-Op->getType()->getScalarType()->getFltSemantics();
-DenormalMode Mode = F->getDenormalMode(FltSem);
-
-// Doubling 0 will give the same 0.
-if (SelfAdd && KnownRHS.isKnownNeverLogicalPosZero(Mode) &&
-(Mode.Output == DenormalMode::IEEE ||
- (Mode.Output == DenormalMode::PreserveSign &&
-  KnownRHS.isKnownNeverPosSubnormal()) ||
- (Mode.Output == DenormalMode::PositiveZero &&
-  KnownRHS.isKnownNeverSubnormal(
-  Known.knownNot(fcPosZero);
-
-// (fadd x, 0.0) is guaranteed to return +0.0, not -0.0.
-if ((KnownLHS.isKnownNeverLogicalNegZero(Mode) ||
- KnownRHS.isKnownNeverLogicalNegZero(Mode)) &&
-// Make sure output negative denormal can't flush to -0
-(Mode.Output == DenormalMode::IEEE ||
- Mode.Output == DenormalMode::PositiveZero))
-  Known.knownNot(fcNegZero);
+  if (Self && Opc == Instruction::FAdd) {
+Known = KnownFPClass::fadd_self(KnownLHS, Mode);
   } else 

[llvm-branch-commits] [llvm] InstCombine: Handle fsub in SimplifyDemandedFPClass (PR #175852)

2026-01-14 Thread Yingwei Zheng via llvm-branch-commits


@@ -279,6 +279,27 @@ KnownFPClass KnownFPClass::fadd_self(const KnownFPClass 
&KnownSrc,
   return Known;
 }
 
+KnownFPClass KnownFPClass::fsub(const KnownFPClass &KnownLHS,
+const KnownFPClass &KnownRHS,
+DenormalMode Mode) {
+  KnownFPClass Known;

dtcxzyw wrote:

We can reinterpret fsub as fadd(LHS, fneg(RHS)).

https://github.com/llvm/llvm-project/pull/175852
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] InstCombine: Handle fsub in SimplifyDemandedFPClass (PR #175852)

2026-01-13 Thread via llvm-branch-commits

github-actions[bot] wrote:


# :penguin: Linux x64 Test Results

* 168042 tests passed
* 2992 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### LLVM

LLVM.Transforms/Attributor/nofpclass.ll

```
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt 
-aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal 
-attributor-annotate-decl-cs -use-constant-fp-for-scalable-splat=false -S < 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/Attributor/nofpclass.ll
 | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck 
--allow-unused-prefixes 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/Attributor/nofpclass.ll
 --check-prefixes=CHECK,CHECK-CV,TUNIT,TUNIT-CV
# executed command: 
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt 
-aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal 
-attributor-annotate-decl-cs -use-constant-fp-for-scalable-splat=false -S
# .---command stderr
# | opt: 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Analysis/ValueTracking.cpp:4960:
 void computeKnownFPClass(const Value *, const APInt &, FPClassTest, 
KnownFPClass &, const SimplifyQuery &, unsigned int): Assertion 
`Known.isUnknown() && "should not be called with known information"' failed.
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ 
and include the crash backtrace and instructions to reproduce the bug.
# | Stack dump:
# | 0.  Program arguments: 
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt 
-aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal 
-attributor-annotate-decl-cs -use-constant-fp-for-scalable-splat=false -S
# | 1.  Running pass "attributor" on module ""
# |  #0 0x050611b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:842:13
# |  #1 0x0505e7d5 llvm::sys::RunSignalHandlers() 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Signals.cpp:109:18
# |  #2 0x05062271 SignalHandler(int, siginfo_t*, void*) 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:429:38
# |  #3 0x7ad6c5306330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
# |  #4 0x7ad6c535fb2c pthread_kill 
(/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
# |  #5 0x7ad6c530627e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
# |  #6 0x7ad6c52e98ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
# |  #7 0x7ad6c52e981b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
# |  #8 0x7ad6c52fc517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
# |  #9 0x05788fb3 computeKnownFPClass(llvm::Value const*, llvm::APInt 
const&, llvm::FPClassTest, llvm::KnownFPClass&, llvm::SimplifyQuery const&, 
unsigned int) 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Analysis/ValueTracking.cpp:0:0
# | #10 0x05787907 computeKnownFPClass(llvm::Value const*, llvm::APInt 
const&, llvm::FPClassTest, llvm::KnownFPClass&, llvm::SimplifyQuery const&, 
unsigned int) 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Analysis/ValueTracking.cpp:0:9
# | #11 0x0578c762 isSingleWord 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/APInt.h:323:47
# | #12 0x0578c762 needsCleanup 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/APInt.h:1941:39
# | #13 0x0578c762 ~APInt 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/APInt.h:192:9
# | #14 0x0578c762 computeKnownFPClass(llvm::Value const*, 
llvm::KnownFPClass&, llvm::FPClassTest, llvm::SimplifyQuery const&, unsigned 
int) 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Analysis/ValueTracking.cpp:4912:1
# | #15 0x0578ce8f llvm::computeKnownFPClass(llvm::Value const*, 
llvm::FPClassTest, llvm::SimplifyQuery const&, unsigned int) 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Analysis/ValueTracking.cpp:6029:3
# | #16 0x06a2bdab Underlying 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/BitmaskEnum.h:137:3
# | #17 0x06a2bdab operator~ 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/BitmaskEnum.h:153:26
# | #18 0x06a2bdab (anonymous 
namespace)::AANoFPClassImpl::initialize(llvm::Attributor&) 
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:10511:20
# | #19 0x069dd0b1 llvm::AANoFPClass const* 
llvm::Attributor::getOrCreateAAFor(llvm::IRPosition, 
llvm::AbstractAttribute const*, llvm::DepClassTy, bool, bool) 
/home/gha/actions-runner/_work/llvm-project/llvm-p

[llvm-branch-commits] [llvm] InstCombine: Handle fsub in SimplifyDemandedFPClass (PR #175852)

2026-01-13 Thread via llvm-branch-commits

github-actions[bot] wrote:


# :window: Windows x64 Test Results

* 129460 tests passed
* 2863 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### LLVM

LLVM.Transforms/Attributor/nofpclass.ll

```
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\opt.exe -aa-pipeline=basic-aa 
-passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs 
-use-constant-fp-for-scalable-splat=false -S < 
C:\_work\llvm-project\llvm-project\llvm\test\Transforms\Attributor\nofpclass.ll 
| c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe 
--allow-unused-prefixes 
C:\_work\llvm-project\llvm-project\llvm\test\Transforms\Attributor\nofpclass.ll 
--check-prefixes=CHECK,CHECK-CV,TUNIT,TUNIT-CV
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\opt.exe' 
-aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal 
-attributor-annotate-decl-cs -use-constant-fp-for-scalable-splat=false -S
# .---command stderr
# | Assertion failed: Known.isUnknown() && "should not be called with known 
information", file 
C:\_work\llvm-project\llvm-project\llvm\lib\Analysis\ValueTracking.cpp, line 
4960
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ 
and include the crash backtrace and instructions to reproduce the bug.
# | Stack dump:
# | 0.  Program arguments: 
c:\\_work\\llvm-project\\llvm-project\\build\\bin\\opt.exe 
-aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal 
-attributor-annotate-decl-cs -use-constant-fp-for-scalable-splat=false -S
# | 1.  Running pass "attributor" on module ""
# | Exception Code: 0xC01D
# |  #0 0x7ff6357b8316 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0x908316)
# |  #1 0x7fff1dd3bb04 (C:\Windows\System32\ucrtbase.dll+0x7bb04)
# |  #2 0x7fff1dd3cad1 (C:\Windows\System32\ucrtbase.dll+0x7cad1)
# |  #3 0x7fff1dd3e4a1 (C:\Windows\System32\ucrtbase.dll+0x7e4a1)
# |  #4 0x7fff1dd3e6e1 (C:\Windows\System32\ucrtbase.dll+0x7e6e1)
# |  #5 0x7ff635b5fb0b 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0xcafb0b)
# |  #6 0x7ff635b61ef9 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0xcb1ef9)
# |  #7 0x7ff635b67c37 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0xcb7c37)
# |  #8 0x7ff635b683f7 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0xcb83f7)
# |  #9 0x7ff6385e010a 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0x373010a)
# | #10 0x7ff6379e4e48 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0x2b34e48)
# | #11 0x7ff6385e1ce6 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0x3731ce6)
# | #12 0x7ff6379c383a 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0x2b1383a)
# | #13 0x7ff6385e1b8e 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0x3731b8e)
# | #14 0x7ff6379ba874 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0x2b0a874)
# | #15 0x7ff6379c700c 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0x2b1700c)
# | #16 0x7ff6379e4e87 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0x2b34e87)
# | #17 0x7ff6379d09b3 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0x2b209b3)
# | #18 0x7ff6379d4670 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0x2b24670)
# | #19 0x7ff6379d3bc2 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0x2b23bc2)
# | #20 0x7ff635f69b71 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0x10b9b71)
# | #21 0x7ff635cef4ad 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0xe3f4ad)
# | #22 0x7ff6351de2fc 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0x32e2fc)
# | #23 0x7ff634eb6e4f 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0x6e4f)
# | #24 0x7ff634eb1025 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0x1025)
# | #25 0x7ff6396faa64 
(c:\_work\llvm-project\llvm-project\build\bin\opt.exe+0x484aa64)
# | #26 0x7fff234b4cb0 (C:\Windows\System32\KERNEL32.DLL+0x14cb0)
# | #27 0x7fff2e43edcb (C:\Windows\SYSTEM32\ntdll.dll+0x7edcb)
# `-
# error: command failed with exit status: 0xc01d
# executed command: 
'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 
--allow-unused-prefixes 
'C:\_work\llvm-project\llvm-project\llvm\test\Transforms\Attributor\nofpclass.ll'
 --check-prefixes=CHECK,CHECK-CV,TUNIT,TUNIT-CV
# .---command stderr
# | FileCheck error: '' is empty.
# | FileCheck command line:  
c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe 
--allow-unused-prefixes 
C:\_work\llvm-project\llvm-project\llvm\test\Transforms\Attributor\nofpclass.ll 
--check-prefixes=CHECK,CHECK-CV,TUNIT,TUNIT-CV
# `-
# error: command failed with exit status: 2

--

```


If these failures are unrelated to your changes (for example tests are broken 
or flaky at HEAD), please open an is

[llvm-branch-commits] [llvm] InstCombine: Handle fsub in SimplifyDemandedFPClass (PR #175852)

2026-01-13 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-llvm-analysis

Author: Matt Arsenault (arsenm)


Changes

alive2 fails on some of the tests, but this is due to existing
folds in instsimplify and https://github.com/AliveToolkit/alive2/issues/1273

---

Patch is 36.18 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/175852.diff


5 Files Affected:

- (modified) llvm/include/llvm/Support/KnownFPClass.h (+5) 
- (modified) llvm/lib/Analysis/ValueTracking.cpp (+17-61) 
- (modified) llvm/lib/Support/KnownFPClass.cpp (+21) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp 
(+11-4) 
- (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fsub.ll 
(+55-73) 


``diff
diff --git a/llvm/include/llvm/Support/KnownFPClass.h 
b/llvm/include/llvm/Support/KnownFPClass.h
index e2b0d20c790a9..010ca6a3e84ec 100644
--- a/llvm/include/llvm/Support/KnownFPClass.h
+++ b/llvm/include/llvm/Support/KnownFPClass.h
@@ -222,6 +222,11 @@ struct KnownFPClass {
   fadd_self(const KnownFPClass &Src,
 DenormalMode Mode = DenormalMode::getDynamic());
 
+  /// Report known values for fsub
+  LLVM_ABI static KnownFPClass
+  fsub(const KnownFPClass &LHS, const KnownFPClass &RHS,
+   DenormalMode Mode = DenormalMode::getDynamic());
+
   /// Report known values for fmul
   LLVM_ABI static KnownFPClass
   fmul(const KnownFPClass &LHS, const KnownFPClass &RHS,
diff --git a/llvm/lib/Analysis/ValueTracking.cpp 
b/llvm/lib/Analysis/ValueTracking.cpp
index 3dc321b28a060..471080cf66c17 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -5510,78 +5510,34 @@ void computeKnownFPClass(const Value *V, const APInt 
&DemandedElts,
 KnownRHS, Q, Depth + 1);
 
 // Special case fadd x, x, which is the canonical form of fmul x, 2.
-bool SelfAdd = Op->getOperand(0) == Op->getOperand(1) &&
-   isGuaranteedNotToBeUndef(Op->getOperand(0), Q.AC, Q.CxtI,
-Q.DT, Depth + 1);
-if (SelfAdd)
+bool Self = Op->getOperand(0) == Op->getOperand(1) &&
+isGuaranteedNotToBeUndef(Op->getOperand(0), Q.AC, Q.CxtI, Q.DT,
+ Depth + 1);
+if (Self)
   KnownLHS = KnownRHS;
 
 if ((WantNaN && KnownRHS.isKnownNeverNaN()) ||
 (WantNegative && KnownRHS.cannotBeOrderedLessThanZero()) ||
 WantNegZero || Opc == Instruction::FSub) {
 
-  if (!SelfAdd) {
-// RHS is canonically cheaper to compute. Skip inspecting the LHS if
-// there's no point.
-computeKnownFPClass(Op->getOperand(0), DemandedElts, InterestedSrcs,
-KnownLHS, Q, Depth + 1);
-  }
-
-  // Adding positive and negative infinity produces NaN.
-  // TODO: Check sign of infinities.
-  if (KnownLHS.isKnownNeverNaN() && KnownRHS.isKnownNeverNaN() &&
-  (KnownLHS.isKnownNeverInfinity() || KnownRHS.isKnownNeverInfinity()))
-Known.knownNot(fcNan);
-
   // FIXME: Context function should always be passed in separately
   const Function *F = cast(Op)->getFunction();
+  const fltSemantics &FltSem =
+  Op->getType()->getScalarType()->getFltSemantics();
+  DenormalMode Mode =
+  F ? F->getDenormalMode(FltSem) : DenormalMode::getDynamic();
 
-  if (Op->getOpcode() == Instruction::FAdd) {
-if (KnownLHS.cannotBeOrderedLessThanZero() &&
-KnownRHS.cannotBeOrderedLessThanZero())
-  Known.knownNot(KnownFPClass::OrderedLessThanZeroMask);
-if (KnownLHS.cannotBeOrderedGreaterThanZero() &&
-KnownRHS.cannotBeOrderedGreaterThanZero())
-  Known.knownNot(KnownFPClass::OrderedGreaterThanZeroMask);
-
-if (!F)
-  break;
-
-const fltSemantics &FltSem =
-Op->getType()->getScalarType()->getFltSemantics();
-DenormalMode Mode = F->getDenormalMode(FltSem);
-
-// Doubling 0 will give the same 0.
-if (SelfAdd && KnownRHS.isKnownNeverLogicalPosZero(Mode) &&
-(Mode.Output == DenormalMode::IEEE ||
- (Mode.Output == DenormalMode::PreserveSign &&
-  KnownRHS.isKnownNeverPosSubnormal()) ||
- (Mode.Output == DenormalMode::PositiveZero &&
-  KnownRHS.isKnownNeverSubnormal(
-  Known.knownNot(fcPosZero);
-
-// (fadd x, 0.0) is guaranteed to return +0.0, not -0.0.
-if ((KnownLHS.isKnownNeverLogicalNegZero(Mode) ||
- KnownRHS.isKnownNeverLogicalNegZero(Mode)) &&
-// Make sure output negative denormal can't flush to -0
-(Mode.Output == DenormalMode::IEEE ||
- Mode.Output == DenormalMode::PositiveZero))
-  Known.knownNot(fcNegZero);
+  if (Self && Opc == Instruction::FAdd) {
+Known = KnownFPClass::fadd_self(KnownLHS, Mode);
   } else {
-if (!F)
-  break;
+

[llvm-branch-commits] [llvm] InstCombine: Handle fsub in SimplifyDemandedFPClass (PR #175852)

2026-01-13 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-llvm-support

Author: Matt Arsenault (arsenm)


Changes

alive2 fails on some of the tests, but this is due to existing
folds in instsimplify and https://github.com/AliveToolkit/alive2/issues/1273

---

Patch is 36.18 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/175852.diff


5 Files Affected:

- (modified) llvm/include/llvm/Support/KnownFPClass.h (+5) 
- (modified) llvm/lib/Analysis/ValueTracking.cpp (+17-61) 
- (modified) llvm/lib/Support/KnownFPClass.cpp (+21) 
- (modified) llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp 
(+11-4) 
- (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-fsub.ll 
(+55-73) 


``diff
diff --git a/llvm/include/llvm/Support/KnownFPClass.h 
b/llvm/include/llvm/Support/KnownFPClass.h
index e2b0d20c790a9..010ca6a3e84ec 100644
--- a/llvm/include/llvm/Support/KnownFPClass.h
+++ b/llvm/include/llvm/Support/KnownFPClass.h
@@ -222,6 +222,11 @@ struct KnownFPClass {
   fadd_self(const KnownFPClass &Src,
 DenormalMode Mode = DenormalMode::getDynamic());
 
+  /// Report known values for fsub
+  LLVM_ABI static KnownFPClass
+  fsub(const KnownFPClass &LHS, const KnownFPClass &RHS,
+   DenormalMode Mode = DenormalMode::getDynamic());
+
   /// Report known values for fmul
   LLVM_ABI static KnownFPClass
   fmul(const KnownFPClass &LHS, const KnownFPClass &RHS,
diff --git a/llvm/lib/Analysis/ValueTracking.cpp 
b/llvm/lib/Analysis/ValueTracking.cpp
index 3dc321b28a060..471080cf66c17 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -5510,78 +5510,34 @@ void computeKnownFPClass(const Value *V, const APInt 
&DemandedElts,
 KnownRHS, Q, Depth + 1);
 
 // Special case fadd x, x, which is the canonical form of fmul x, 2.
-bool SelfAdd = Op->getOperand(0) == Op->getOperand(1) &&
-   isGuaranteedNotToBeUndef(Op->getOperand(0), Q.AC, Q.CxtI,
-Q.DT, Depth + 1);
-if (SelfAdd)
+bool Self = Op->getOperand(0) == Op->getOperand(1) &&
+isGuaranteedNotToBeUndef(Op->getOperand(0), Q.AC, Q.CxtI, Q.DT,
+ Depth + 1);
+if (Self)
   KnownLHS = KnownRHS;
 
 if ((WantNaN && KnownRHS.isKnownNeverNaN()) ||
 (WantNegative && KnownRHS.cannotBeOrderedLessThanZero()) ||
 WantNegZero || Opc == Instruction::FSub) {
 
-  if (!SelfAdd) {
-// RHS is canonically cheaper to compute. Skip inspecting the LHS if
-// there's no point.
-computeKnownFPClass(Op->getOperand(0), DemandedElts, InterestedSrcs,
-KnownLHS, Q, Depth + 1);
-  }
-
-  // Adding positive and negative infinity produces NaN.
-  // TODO: Check sign of infinities.
-  if (KnownLHS.isKnownNeverNaN() && KnownRHS.isKnownNeverNaN() &&
-  (KnownLHS.isKnownNeverInfinity() || KnownRHS.isKnownNeverInfinity()))
-Known.knownNot(fcNan);
-
   // FIXME: Context function should always be passed in separately
   const Function *F = cast(Op)->getFunction();
+  const fltSemantics &FltSem =
+  Op->getType()->getScalarType()->getFltSemantics();
+  DenormalMode Mode =
+  F ? F->getDenormalMode(FltSem) : DenormalMode::getDynamic();
 
-  if (Op->getOpcode() == Instruction::FAdd) {
-if (KnownLHS.cannotBeOrderedLessThanZero() &&
-KnownRHS.cannotBeOrderedLessThanZero())
-  Known.knownNot(KnownFPClass::OrderedLessThanZeroMask);
-if (KnownLHS.cannotBeOrderedGreaterThanZero() &&
-KnownRHS.cannotBeOrderedGreaterThanZero())
-  Known.knownNot(KnownFPClass::OrderedGreaterThanZeroMask);
-
-if (!F)
-  break;
-
-const fltSemantics &FltSem =
-Op->getType()->getScalarType()->getFltSemantics();
-DenormalMode Mode = F->getDenormalMode(FltSem);
-
-// Doubling 0 will give the same 0.
-if (SelfAdd && KnownRHS.isKnownNeverLogicalPosZero(Mode) &&
-(Mode.Output == DenormalMode::IEEE ||
- (Mode.Output == DenormalMode::PreserveSign &&
-  KnownRHS.isKnownNeverPosSubnormal()) ||
- (Mode.Output == DenormalMode::PositiveZero &&
-  KnownRHS.isKnownNeverSubnormal(
-  Known.knownNot(fcPosZero);
-
-// (fadd x, 0.0) is guaranteed to return +0.0, not -0.0.
-if ((KnownLHS.isKnownNeverLogicalNegZero(Mode) ||
- KnownRHS.isKnownNeverLogicalNegZero(Mode)) &&
-// Make sure output negative denormal can't flush to -0
-(Mode.Output == DenormalMode::IEEE ||
- Mode.Output == DenormalMode::PositiveZero))
-  Known.knownNot(fcNegZero);
+  if (Self && Opc == Instruction::FAdd) {
+Known = KnownFPClass::fadd_self(KnownLHS, Mode);
   } else {
-if (!F)
-  break;
+ 

[llvm-branch-commits] [llvm] InstCombine: Handle fsub in SimplifyDemandedFPClass (PR #175852)

2026-01-13 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm ready_for_review 
https://github.com/llvm/llvm-project/pull/175852
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] InstCombine: Handle fsub in SimplifyDemandedFPClass (PR #175852)

2026-01-13 Thread Matt Arsenault via llvm-branch-commits

arsenm wrote:

> [!WARNING]
> This pull request is not mergeable via GitHub because a downstack PR is 
> open. Once all requirements are satisfied, merge this PR as a stack  href="https://app.graphite.com/github/pr/llvm/llvm-project/175852?utm_source=stack-comment-downstack-mergeability-warning";
>  >on Graphite.
> https://graphite.dev/docs/merge-pull-requests";>Learn more

* **#175852** https://app.graphite.com/github/pr/llvm/llvm-project/175852?utm_source=stack-comment-icon";
 target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" 
width="10px" height="10px"/> 👈 https://app.graphite.com/github/pr/llvm/llvm-project/175852?utm_source=stack-comment-view-in-graphite";
 target="_blank">(View in Graphite)
* **#175851** https://app.graphite.com/github/pr/llvm/llvm-project/175851?utm_source=stack-comment-icon";
 target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" 
width="10px" height="10px"/>
* `main`




This stack of pull requests is managed by https://graphite.dev?utm-source=stack-comment";>Graphite. Learn 
more about https://stacking.dev/?utm_source=stack-comment";>stacking.


https://github.com/llvm/llvm-project/pull/175852
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] InstCombine: Handle fsub in SimplifyDemandedFPClass (PR #175852)

2026-01-13 Thread Matt Arsenault via llvm-branch-commits

https://github.com/arsenm created 
https://github.com/llvm/llvm-project/pull/175852

alive2 fails on some of the tests, but this is due to existing
folds in instsimplify and https://github.com/AliveToolkit/alive2/issues/1273

>From c33a55577393d52e90db93cc36ccec2cdfb17016 Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Mon, 5 Jan 2026 14:20:21 +0100
Subject: [PATCH] InstCombine: Handle fsub in SimplifyDemandedFPClass

alive2 fails on some of the tests, but this is due to existing
folds in instsimplify and https://github.com/AliveToolkit/alive2/issues/1273
---
 llvm/include/llvm/Support/KnownFPClass.h  |   5 +
 llvm/lib/Analysis/ValueTracking.cpp   |  78 +++
 llvm/lib/Support/KnownFPClass.cpp |  21 +++
 .../InstCombineSimplifyDemanded.cpp   |  15 +-
 .../simplify-demanded-fpclass-fsub.ll | 128 --
 5 files changed, 109 insertions(+), 138 deletions(-)

diff --git a/llvm/include/llvm/Support/KnownFPClass.h 
b/llvm/include/llvm/Support/KnownFPClass.h
index e2b0d20c790a9..010ca6a3e84ec 100644
--- a/llvm/include/llvm/Support/KnownFPClass.h
+++ b/llvm/include/llvm/Support/KnownFPClass.h
@@ -222,6 +222,11 @@ struct KnownFPClass {
   fadd_self(const KnownFPClass &Src,
 DenormalMode Mode = DenormalMode::getDynamic());
 
+  /// Report known values for fsub
+  LLVM_ABI static KnownFPClass
+  fsub(const KnownFPClass &LHS, const KnownFPClass &RHS,
+   DenormalMode Mode = DenormalMode::getDynamic());
+
   /// Report known values for fmul
   LLVM_ABI static KnownFPClass
   fmul(const KnownFPClass &LHS, const KnownFPClass &RHS,
diff --git a/llvm/lib/Analysis/ValueTracking.cpp 
b/llvm/lib/Analysis/ValueTracking.cpp
index 3dc321b28a060..471080cf66c17 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -5510,78 +5510,34 @@ void computeKnownFPClass(const Value *V, const APInt 
&DemandedElts,
 KnownRHS, Q, Depth + 1);
 
 // Special case fadd x, x, which is the canonical form of fmul x, 2.
-bool SelfAdd = Op->getOperand(0) == Op->getOperand(1) &&
-   isGuaranteedNotToBeUndef(Op->getOperand(0), Q.AC, Q.CxtI,
-Q.DT, Depth + 1);
-if (SelfAdd)
+bool Self = Op->getOperand(0) == Op->getOperand(1) &&
+isGuaranteedNotToBeUndef(Op->getOperand(0), Q.AC, Q.CxtI, Q.DT,
+ Depth + 1);
+if (Self)
   KnownLHS = KnownRHS;
 
 if ((WantNaN && KnownRHS.isKnownNeverNaN()) ||
 (WantNegative && KnownRHS.cannotBeOrderedLessThanZero()) ||
 WantNegZero || Opc == Instruction::FSub) {
 
-  if (!SelfAdd) {
-// RHS is canonically cheaper to compute. Skip inspecting the LHS if
-// there's no point.
-computeKnownFPClass(Op->getOperand(0), DemandedElts, InterestedSrcs,
-KnownLHS, Q, Depth + 1);
-  }
-
-  // Adding positive and negative infinity produces NaN.
-  // TODO: Check sign of infinities.
-  if (KnownLHS.isKnownNeverNaN() && KnownRHS.isKnownNeverNaN() &&
-  (KnownLHS.isKnownNeverInfinity() || KnownRHS.isKnownNeverInfinity()))
-Known.knownNot(fcNan);
-
   // FIXME: Context function should always be passed in separately
   const Function *F = cast(Op)->getFunction();
+  const fltSemantics &FltSem =
+  Op->getType()->getScalarType()->getFltSemantics();
+  DenormalMode Mode =
+  F ? F->getDenormalMode(FltSem) : DenormalMode::getDynamic();
 
-  if (Op->getOpcode() == Instruction::FAdd) {
-if (KnownLHS.cannotBeOrderedLessThanZero() &&
-KnownRHS.cannotBeOrderedLessThanZero())
-  Known.knownNot(KnownFPClass::OrderedLessThanZeroMask);
-if (KnownLHS.cannotBeOrderedGreaterThanZero() &&
-KnownRHS.cannotBeOrderedGreaterThanZero())
-  Known.knownNot(KnownFPClass::OrderedGreaterThanZeroMask);
-
-if (!F)
-  break;
-
-const fltSemantics &FltSem =
-Op->getType()->getScalarType()->getFltSemantics();
-DenormalMode Mode = F->getDenormalMode(FltSem);
-
-// Doubling 0 will give the same 0.
-if (SelfAdd && KnownRHS.isKnownNeverLogicalPosZero(Mode) &&
-(Mode.Output == DenormalMode::IEEE ||
- (Mode.Output == DenormalMode::PreserveSign &&
-  KnownRHS.isKnownNeverPosSubnormal()) ||
- (Mode.Output == DenormalMode::PositiveZero &&
-  KnownRHS.isKnownNeverSubnormal(
-  Known.knownNot(fcPosZero);
-
-// (fadd x, 0.0) is guaranteed to return +0.0, not -0.0.
-if ((KnownLHS.isKnownNeverLogicalNegZero(Mode) ||
- KnownRHS.isKnownNeverLogicalNegZero(Mode)) &&
-// Make sure output negative denormal can't flush to -0
-(Mode.Output == DenormalMode::IEEE ||
- Mode.Output == DenormalMode::PositiveZero))
-  Known.kno