This is an archive of the discontinued LLVM Phabricator instance.

ValueTracking: Address todo for nan fmul handling in computeKnownFPClass
ClosedPublic

Authored by arsenm on Apr 8 2023, 4:05 PM.

Details

Summary

If both operands can't be zero or nan, the result can't be nan.

Diff Detail

Event Timeline

arsenm created this revision.Apr 8 2023, 4:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 8 2023, 4:05 PM
arsenm requested review of this revision.Apr 8 2023, 4:05 PM
Herald added a reviewer: sstefan1. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: wdng. · View Herald Transcript
nikic added inline comments.Apr 11 2023, 4:31 AM
llvm/lib/Analysis/ValueTracking.cpp
4477–4485

Add TODO to check correct pairs? E.g. nofpclass(inf nan zero) fmul nofpclass(nan) should be fine, right? We need inf on one side and zero on the other.

Also, can you please remind me what happens if we multiply a denormal with flush to zero semantics with inf? Does that become inf or nan?

arsenm updated this revision to Diff 512860.Apr 12 2023, 8:56 AM
arsenm marked an inline comment as done.

Fix DAZ handling and add comment

nikic added a comment.Apr 12 2023, 2:02 PM

Could you please also add test coverage for the denormal handling?

llvm/lib/Analysis/ValueTracking.cpp
4468

Don't we also need to pass in fcSubnormal as well for these?

Could you please also add test coverage for the denormal handling?

I did but somehow it's not in the diff

llvm/lib/Analysis/ValueTracking.cpp
4468

It's not strictly necessary since we're not really making use of these hints yet

arsenm updated this revision to Diff 512978.Apr 12 2023, 2:50 PM

Fix test diff

nikic accepted this revision.Apr 13 2023, 1:30 AM

LGTM

llvm/lib/Analysis/ValueTracking.cpp
4468

Even if it's not used yet, we should include it so it continues working in the future... Or just drop the argument entirely.

This revision is now accepted and ready to land.Apr 13 2023, 1:30 AM