Add target dependent DAG combine for select node. The optimization is transform
select Cond, X, 0 to and (sext Cond), X. For RISCV, this optimization can decrease
code size. Other Arch(like X86) seems not. So I didn't add this optimization to generic
DAG Combine.
Details
Details
- Reviewers
craig.topper frasercrmck jrtc27 asb sjarus
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Unit Tests
Event Timeline
Comment Actions
Are you sure this is a code size win with RVC? Also much less likely to be macro-op fused; conditional branch followed by a move is one of the things you can easily fuse, and some cores already implement predicated execution for short forward conditional branches.
llvm/test/CodeGen/RISCV/selectcc-to-shiftand.ll | ||
---|---|---|
21 | This is clearly worse |
This is clearly worse