This patch addresses @paulwalker-arm's comment on D117900 to
only update/write the by-ref operands iff the function returns
true. It also handles a few more cases where a series of added
offsets can be folded into the base pointer, rather than just looking
at a single offset.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
llvm/test/CodeGen/AArch64/sve-gather-scatter-addr-opts.ll | ||
---|---|---|
302 | If I switch this the fold does not happen. I know this was not supported before, but should we try to support now? |
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | ||
---|---|---|
16454 | Is Index guaranteed to be a vector of i64s? For the general case I believe it can be any type so you'll either need an early exit if the scenario is unlikely or some kind of extension if it's something you care about, otherwise code like this will assert. | |
16474–16475 | I guess it doesn't matter arithmetically? but is there a reason to switch from the original (Offset << Shift) * Scale to (Offset * Scale) << Shift? |
Added condition to findMoreOptimalIndexType that index is a vector of
i64's and swapped order of shl/mul since scale is guaranteed to be constant.
Is Index guaranteed to be a vector of i64s? For the general case I believe it can be any type so you'll either need an early exit if the scenario is unlikely or some kind of extension if it's something you care about, otherwise code like this will assert.