llvm.org GIT mirror llvm / 97874bd
[GlobalISel][AArch64] Fold FI into LDR/STR ui addressing mode. A majority of loads and stores at O0 access an alloca. It's trivial to fold the G_FRAME_INDEX into the instruction; do it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298864 91177308-0d34-0410-b5e6-96231b3b80d8 Ahmed Bougacha 3 years ago
3 changed file(s) with 71 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
791791 }
792792 }
793793
794 // If we haven't folded anything into our addressing mode yet, try to fold
795 // a frame index into the base+offset.
796 if (!Offset && PtrMI->getOpcode() == TargetOpcode::G_FRAME_INDEX)
797 I.getOperand(1).ChangeToFrameIndex(PtrMI->getOperand(1).getIndex());
798
794799 I.addOperand(MachineOperand::CreateImm(Offset));
795800
796801 // If we're storing a 0, use WZR/XZR.
77 define void @load_s16_gpr(i16* %addr) { ret void }
88 define void @load_s8_gpr(i8* %addr) { ret void }
99
10 define void @load_fi_s64_gpr() {
11 %ptr0 = alloca i64
12 ret void
13 }
14
1015 define void @load_gep_128_s64_gpr(i64* %addr) { ret void }
1116 define void @load_gep_512_s32_gpr(i32* %addr) { ret void }
1217 define void @load_gep_64_s16_gpr(i16* %addr) { ret void }
125130 ...
126131
127132 ---
133 # CHECK-LABEL: name: load_fi_s64_gpr
134 name: load_fi_s64_gpr
135 legalized: true
136 regBankSelected: true
137
138 # CHECK: registers:
139 # CHECK-NEXT: - { id: 0, class: gpr }
140 # CHECK-NEXT: - { id: 1, class: gpr64 }
141 registers:
142 - { id: 0, class: gpr }
143 - { id: 1, class: gpr }
144
145 stack:
146 - { id: 0, name: ptr0, offset: 0, size: 8, alignment: 8 }
147
148 # CHECK: body:
149 # CHECK: %1 = LDRXui %stack.0.ptr0, 0 :: (load 8)
150 # CHECK: %x0 = COPY %1
151 body: |
152 bb.0:
153 liveins: %x0
154
155 %0(p0) = G_FRAME_INDEX %stack.0.ptr0
156 %1(s64) = G_LOAD %0 :: (load 8)
157 %x0 = COPY %1(s64)
158 ...
159
160 ---
128161 # CHECK-LABEL: name: load_gep_128_s64_gpr
129162 name: load_gep_128_s64_gpr
130163 legalized: true
1010 define void @store_zero_s64_gpr(i64* %addr) { ret void }
1111 define void @store_zero_s32_gpr(i32* %addr) { ret void }
1212
13 define void @store_fi_s64_gpr() {
14 %ptr0 = alloca i64
15 ret void
16 }
17
1318 define void @store_gep_128_s64_gpr(i64* %addr) { ret void }
1419 define void @store_gep_512_s32_gpr(i32* %addr) { ret void }
1520 define void @store_gep_64_s16_gpr(i16* %addr) { ret void }
183188 ...
184189
185190 ---
191 # CHECK-LABEL: name: store_fi_s64_gpr
192 name: store_fi_s64_gpr
193 legalized: true
194 regBankSelected: true
195
196 # CHECK: registers:
197 # CHECK-NEXT: - { id: 0, class: gpr64 }
198 # CHECK-NEXT: - { id: 1, class: gpr }
199 registers:
200 - { id: 0, class: gpr }
201 - { id: 1, class: gpr }
202
203 stack:
204 - { id: 0, name: ptr0, offset: 0, size: 8, alignment: 8 }
205
206 # CHECK: body:
207 # CHECK: %0 = COPY %x0
208 # CHECK: STRXui %0, %stack.0.ptr0, 0 :: (store 8)
209 body: |
210 bb.0:
211 liveins: %x0
212
213 %0(p0) = COPY %x0
214 %1(p0) = G_FRAME_INDEX %stack.0.ptr0
215 G_STORE %0, %1 :: (store 8)
216 ...
217
218 ---
186219 # CHECK-LABEL: name: store_gep_128_s64_gpr
187220 name: store_gep_128_s64_gpr
188221 legalized: true