HomePhabricator

[RISCV] Optimize Branch Comparisons

Authored by lenary on Jan 15 2021, 3:20 AM.

Description

[RISCV] Optimize Branch Comparisons

I noticed in D94450 that there were quite a few places where we generate
the sequence:

xN <- comparison ...
xN <- xor xN, 1
bnez xN, symbol

Given we know the XOR will be used by BRCOND, which only looks at the lowest
bit, I think we can remove the XOR and just invert the branch condition in
these cases?

The case mostly seems to come up in floating point tests, where there is often
more logic to combine the results of multiple SETCCs, rather than a single
(BRCOND (SETCC ...) ...).

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D94535

Details

Committed
lenaryJan 15 2021, 3:28 AM
Reviewer
craig.topper
Differential Revision
D94535: [RISCV] Optimize Branch Comparisons
Parents
rGb9993fcbf53a: DynamicRegisterInfo calculate offsets in separate function
Branches
Unknown
Tags
Unknown