[llvm] [RISCV] Add a pass to eliminate special copies in order to facilitate shrink-wrap optimization (PR #140716)

Liao Chunyu via llvm-commits llvm-commits at lists.llvm.org
Wed May 21 17:51:06 PDT 2025


ChunyuLiao wrote:

This work was originally motivated by issue 473, which revealed that LLVM's shrink wrapping implementation performs poorly in certain cases.


```
t4: i64,ch = CopyFromReg t0, Register:i64 %1
t8: i64 = AssertZext t4, ValueType:ch:i32
t11: ch = CopyToReg t0, Register:i64 %2, t8
```

This case only works because there is a type promotion involved;  without the type promotion, it wouldn't be effective.

The reason for adding this pass is that it operates on the full register, which makes it safer.

https://github.com/llvm/llvm-project/pull/140716


More information about the llvm-commits mailing list