[llvm] [RISCV][WIP] Fold (sh3add Z, (add X, (slli Y, 6))) -> (sh3add (sh3add Y, Z), X). (PR #85734)

Wang Pengcheng via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 00:34:19 PDT 2024


wangpc-pp wrote:

> > I'm think about introducing `ISD::GetElementPtr` just like `TargetOpcode::G_PTR_ADD`. Would that be more generic?
> 
> What's the motivation for that?

It's mainly because:
> We do a lot of work during isel to find shXadd and slli instructions that are obscured.

If we can lower GEP directly, I think that would be easier to optimize.

> 
> I don't know if that's more generic. G_PTR_ADD only takes two operands, a pointer and an offset. A GEP with two indices can be lowered to a G_PTR_ADD+SHL for each index or one G_PTR_ADD with ADDs and SHLs to calculate the offset. And there are a couple ways to calculate the offset.



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


More information about the llvm-commits mailing list