This is an archive of the discontinued LLVM Phabricator instance.

[SDAG] fix miscompile when casting int->FP->int
ClosedPublic

Authored by spatel on May 2 2022, 7:20 AM.

Details

Summary

This is the codegen equivalent of D124692.

There's some (experimental?) app for verifying IR -> AArch asm, so the codegen tests can be used to exercise that.

As shown in https://github.com/llvm/llvm-project/issues/55150 - the existing fold may be wrong when converting to a signed value.
This is a quick fix to avoid the miscompile.
https://alive2.llvm.org/ce/z/KtaDmd

We could go further - there was no test coverage added for this group of folds with:
https://github.com/llvm/llvm-project/commit/3e0023b8f6277b4b1335214bdf5ea4a76005fe33
...it seems to have been tacked on for completeness with respect to the IR transforms.
And I don't see any evidence that these patterns arise in SDAG, so we could delete the whole FoldIntToFPToInt() call.

Diff Detail

Event Timeline

spatel created this revision.May 2 2022, 7:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2022, 7:21 AM
spatel requested review of this revision.May 2 2022, 7:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2022, 7:21 AM
efriedma accepted this revision.May 2 2022, 9:14 AM

LGTM

This revision is now accepted and ready to land.May 2 2022, 9:14 AM
This revision was landed with ongoing or failed builds.May 2 2022, 11:57 AM
This revision was automatically updated to reflect the committed changes.