This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Make use of low zero bits to determine exact int->fp cast
ClosedPublic

Authored by Allen on Jun 30 2022, 1:52 AM.

Diff Detail

Event Timeline

Allen created this revision.Jun 30 2022, 1:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 30 2022, 1:52 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
Allen requested review of this revision.Jun 30 2022, 1:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 30 2022, 1:52 AM
Allen edited the summary of this revision. (Show Details)Jun 30 2022, 1:54 AM
spatel added inline comments.Jul 1 2022, 11:36 AM
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
1760–1761

Change variable name to SigBits since we're not only counting high zeros now?

llvm/test/Transforms/InstCombine/sitofp.ll
250

This test would be better with 16777218 (= 1 << 24 + 2). That would test the limits of high and low set bits, and the next test shows that we did not go past the limit.

Allen updated this revision to Diff 441852.Jul 1 2022, 7:21 PM
Allen marked 2 inline comments as done.
Allen added inline comments.
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
1760–1761

Thanks @spatel,apply your comment

llvm/test/Transforms/InstCombine/sitofp.ll
250

Done

spatel accepted this revision.Jul 3 2022, 6:48 AM

LGTM

This revision is now accepted and ready to land.Jul 3 2022, 6:48 AM
nikic added inline comments.Jul 3 2022, 7:43 AM
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
1759

The "or compute low bit mask" part can probably be dropped now?

xbolva00 added inline comments.
llvm/test/Transforms/InstCombine/sitofp.ll
256–269

Remove todo?

Allen updated this revision to Diff 441989.Jul 3 2022, 6:09 PM
Allen marked 2 inline comments as done.
This revision was landed with ongoing or failed builds.Jul 4 2022, 6:27 PM
This revision was automatically updated to reflect the committed changes.
Allen marked 2 inline comments as done.