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
Summary:
When a CondBranch's input is produced by a compare instruction in the same basic
block with no intervening flag-clobbering instructions, fuse them into a direct
cmp + jcc sequence instead of the previous cmp + setcc + test + je sequence.
The post-register-allocation rewrite in doRewriteCondBranch now walks backwards
to find a fusible compare using the existing compareToBranchCC()
infrastructure. When found, it skips emitting the test instruction and uses the
appropriate conditional branch opcode (e.g., jb for unsigned less-than) directly
from the compare's flags.
The setcc materialization from the compare is still emitted but becomes dead
code when the CBool result has no other uses. Eliminating this dead setcc by
converting the compare to kCmp is left as a future improvement — it requires
liveness information from the register allocator to verify the output register
isn't live-out from the block.
Reviewed By: yoney
Differential Revision: D96956101
fbshipit-source-id: 2cde9ca7b9834d2691c56e38ad8d4c5f24ed1622
0 commit comments