llvm-project
8742022e - [RISCV] Canonicalize foldable branch conditions in optimizeCondBranch (#132988)

Commit
261 days ago
[RISCV] Canonicalize foldable branch conditions in optimizeCondBranch (#132988) optimizeCondBranch isn't allowed to modify the CFG, but it can rewrite the branch condition freely. However, If we could fold a conditional branch to an unconditional one (aside from that restriction), we can also rewrite it into some canonical conditional branch instead. Looking at the diffs, the only cases this catches in tree tests are cases where we could have constant folded during lowering from IR, but didn't. This is inspired by trying to salvage code from https://github.com/llvm/llvm-project/pull/131684 which might be useful. Given the test impact, it's of questionable merits. The main advantage over only the late cleanup pass is that it kills off the LIs for the constants early - which can help e.g. register allocation.
Author
Parents
Loading