This is an archive of the discontinued LLVM Phabricator instance.

ValueTracking: Fix nan result handling for fmul
ClosedPublic

Authored by arsenm on Jun 14 2023, 1:50 PM.

Details

Summary

This was mishandling maybe 0 * inf.

Fixes issue #63316

Diff Detail

Event Timeline

arsenm created this revision.Jun 14 2023, 1:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2023, 1:50 PM
arsenm requested review of this revision.Jun 14 2023, 1:50 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
foad added inline comments.Jun 15 2023, 1:38 AM
llvm/lib/Analysis/ValueTracking.cpp
4777–4780

Independent of the bug fix, a stronger form of this check is...
i.e. it can't be 0*inf AND it can't be inf*0
Your version misses some simple cases like when all we know is that neither operand is infinity.

arsenm updated this revision to Diff 531705.Jun 15 2023, 5:08 AM

Handle all the cases

foad accepted this revision.Jun 15 2023, 6:09 AM
foad added inline comments.
llvm/lib/Analysis/ValueTracking.cpp
4785

Would it be worth changing isKnownNeverLogicalZero to take a Function * and handle the nullptr case conservatively?

4787–4792

This is still simpler.

This revision is now accepted and ready to land.Jun 15 2023, 6:09 AM
arsenm added inline comments.Jun 15 2023, 6:10 AM
llvm/lib/Analysis/ValueTracking.cpp
4785

I was more looking into removing the allow-unparented instructions case since SimplifyInstruction now requires parents