Open sftlbcn opened 1 week ago
This missed optimisation is related to the semantics of nuw/nsw
with trunc
:
If the nuw keyword is present, and any of the truncated bits are non-zero, the result is a poison value. If the nsw keyword is present, and any of the truncated bits are not the same as the top bit of the truncation result, the result is a poison value.
Essentially your code assume %x
can be only 0 or 1.
Confirmed that this pattern exists in some real-world code :)
Hi!
This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
test/
create fine-grained testing targets, so you can e.g. use make check-clang-ast
to only run Clang's AST tests.git clang-format HEAD~1
to format your changes.If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.
@llvm/issue-subscribers-good-first-issue
Author: None (sftlbcn)
I'd like to work on this
https://alive2.llvm.org/ce/z/grTNkc