[PATCH] D134975: [SCCP] try to convert sitofp to uitofp

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 30 11:00:37 PDT 2022


spatel created this revision.
spatel added reviewers: nikic, fhahn, efriedma.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: All.
spatel requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This is another small extension of the signed->unsigned logic. This can enable subsequent FP folds because it eliminates negative FP values. Example:
https://alive2.llvm.org/ce/z/tnwfVk

Codegen can invert the transform if it can see that the input signbit is clear.

There was a comment on a test saying not to try this, but I don't see a reason to avoid it. I adjusted one of the existing tests to show that we are not miscompiling when the range includes a negative value.


https://reviews.llvm.org/D134975

Files:
  llvm/lib/Transforms/Scalar/SCCP.cpp
  llvm/test/Transforms/SCCP/ip-ranges-casts.ll
  llvm/test/Transforms/SCCP/sitofp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134975.464322.patch
Type: text/x-patch
Size: 4829 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220930/a062b501/attachment.bin>


More information about the llvm-commits mailing list