Optimize load/store with an iadd_imm operand.

Fold the immediate into the load/store offset when possible.
This commit is contained in:
Dan Gohman
2018-09-28 22:56:39 -07:00
parent 709eed21c1
commit 54ab1ea533
3 changed files with 159 additions and 89 deletions

View File

@@ -0,0 +1,18 @@
test postopt
target x86_64
; Fold the immediate of an iadd_imm into an address offset.
function u0:0(i64 vmctx) -> i64 {
ebb0(v0: i64):
v1 = iadd_imm.i64 v0, 16
[RexOp1ldDisp8#808b] v2 = load.i64 notrap aligned v1
[Op1ret#c3] return v2
}
; sameln: function u0:0(i64 vmctx) -> i64 fast {
; nextln: ebb0(v0: i64):
; nextln: v1 = iadd_imm v0, 16
; nextln: [RexOp1ldDisp8#808b] v2 = load.i64 notrap aligned v0+16
; nextln: [Op1ret#c3] return v2
; nextln: }