This is an archive of the discontinued LLVM Phabricator instance.

[x86] fix miscompile from wrongly identified fneg
ClosedPublic

Authored by spatel on Jun 1 2022, 5:51 AM.

Details

Summary

We may need to peek through a bitcast when identifying an fneg idiom via its pool constant, but we can't allow a different-sized constant in that match.

This is noted in issue #55758 with an example that needs fast-math, but as the test here shows, this has potential to miscompile more generally (no fast-math required).

Diff Detail

Event Timeline

spatel created this revision.Jun 1 2022, 5:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2022, 5:51 AM
spatel requested review of this revision.Jun 1 2022, 5:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2022, 5:51 AM
RKSimon accepted this revision.Jun 1 2022, 6:06 AM

LGTM - its annoying that we don't see the XOR constants, but the 2 XORs (mostly) demonstrate what's happening - if it folded to a single XOR it'd be trickier.

This revision is now accepted and ready to land.Jun 1 2022, 6:06 AM
This revision was landed with ongoing or failed builds.Jun 1 2022, 6:56 AM
This revision was automatically updated to reflect the committed changes.