[llvm] [InstSimplify][InstCombine] Handle nsz in fabs(fneg x) (llvm#151303) (PR #187994)

Pedro Vicente via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 11 16:55:39 PDT 2026


pedroMVicente wrote:

> Is this superseded by #186315? Should these tests be moved over there?

I believe it does.
The main problem in this bug is that computeKnownFPClass  states that the instruction has no signed zeros (which is not true since nsz is non-deterministic). If we set to false directly in InstSimplify, the correct simplification is the one shown in here  https://alive2.llvm.org/ce/z/8G_Hzp.

If later on you choose to remove the nsz flag has discussed in the related discourse link of the issue, the simplification is the one shown here https://alive2.llvm.org/ce/z/zrszzo.

All the other tests are actually an effect of not simplifying the instruction with nsz flag. So I belive they do not change if changing the code in ValueTracking.

@cardigan1008 @arsenm 

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


More information about the llvm-commits mailing list