[RISCV] Fold (add X, [-4096, -2049]) or (add X, [2048,4096]) into load/store address...
authorCraig Topper <craig.topper@sifive.com>
Tue, 28 Jun 2022 23:48:14 +0000 (16:48 -0700)
committerCraig Topper <craig.topper@sifive.com>
Tue, 28 Jun 2022 23:59:39 +0000 (16:59 -0700)
commit5dcc5254925ad84b3949b2bef8345579611bd6f9
treeb9e56bfdb975cc7cf2033a49c78f9352562bbfc9
parentf91d82816ff5a88a59e86b54a4d63547776d4854
[RISCV] Fold (add X, [-4096, -2049]) or (add X, [2048,4096]) into load/store address during isel.

Previously we iseled this to a pair of ADDIs and relied on a post
isel peephole to fold one of the ADDIs into the load/store. Now
we split the immediate in two parts the same way isel does and fold
one of the pieces. If the add has a non-memory use it will emit
two isels and larger one will CSE with the ADDI we created for the
the memory use.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D128741
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp