You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to implement this optimization in IR by folding icmp eq %x, 1 to trunc %x to i1 in #83829, but it doesn't work well, since InstCombine would canonicalize trunc to (X & 1) != 0, which results in one more and instruction in backend.
So, I am going to implement this optimization in backend. Please let me know if there is a better way to address this issue.
If possible, please assign this issue to me, thanks.
The text was updated successfully, but these errors were encountered:
For the IR
which generates the following instructions in x86 (https://godbolt.org/z/hY5EjobTv):
The conversion of
eax
tobool
is redundant afterjae
, we can directlyret
(eax
) aseax
is already in valid bool range [0, 1].This issue is extracted from rust-lang/rust#121673.
I tried to implement this optimization in IR by folding
icmp eq %x, 1
totrunc %x to i1
in #83829, but it doesn't work well, since InstCombine would canonicalizetrunc
to(X & 1) != 0
, which results in one moreand
instruction in backend.So, I am going to implement this optimization in backend. Please let me know if there is a better way to address this issue.
If possible, please assign this issue to me, thanks.
The text was updated successfully, but these errors were encountered: