[llvm] [PowerPC] Do not generate `isel` instruction if target doesn't have this instruction (PR #72845)

Kai Luo via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 26 23:48:05 PST 2023


bzEq wrote:

> I asked a similar question on the previous patch that turned off insertion of isel in Early If Conversion...

I'll answer all of them here.

> What problem is this solving?

We observed some redundant copies in branches after `PPCExpandISEL`, these copies can be removed if corresponding computing was sunk into the branch.

> PPCExpandISEL should be getting rid of these on targets that don't support them.
> Why is this advantageous over the previous solution to always generate isel and then eliminate it if it needs to be eliminated?

Yes. However, `PPCExpandISEL` is a late pass. If we can convert `isel`s to branches early, we'll have MIR SSA optimizations running on these converted branches and might sink corresponding computing(those only needed in true/false branch) into their branches, thus reduce instructions executed in runtime.

Among these passes, `EarlyIfConvertor` is the one that might convert branches into `isel`. We don't want to see branches converted to `isel` back and forth, so I disable `EarlyIfConvertor` on targets not supporting `isel` in https://github.com/llvm/llvm-project/pull/72211.

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


More information about the llvm-commits mailing list