llvm.org GIT mirror llvm / 54ed08e
Merge r196725 (conflicts on same API as before): ------------------------------------------------------------------------ r196725 | tnorthover | 2013-12-08 15:56:50 +0000 (Sun, 08 Dec 2013) | 19 lines ARM: fix folding of stack-adjustment (yet again). When trying to eliminate an "sub sp, sp, #N" instruction by folding it into an existing push/pop using dummy registers, we need to account for the fact that this might affect precisely how "fp" gets set in the prologue. We were attempting this, but assuming that *whenever* we performed a fold it would make a difference. This is false, for example, in: push {r4, r7, lr} add fp, sp, #4 vpush {d8} sub sp, sp, #8 we can fold the "sub" into the "vpush", forming "vpush {d7, d8}". However, in that case the "add fp" instruction mustn't change, which we were getting wrong before. Should fix PR18160. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@196769 91177308-0d34-0410-b5e6-96231b3b80d8 Tim Northover 6 years ago
2 changed file(s) with 13 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
255255
256256 if (NumBytes) {
257257 // Adjust SP after all the callee-save spills.
258 if (tryFoldSPUpdateIntoPushPop(MF, LastPush, NumBytes))
259 FramePtrOffsetInPush += NumBytes;
260 else
258 if (tryFoldSPUpdateIntoPushPop(MF, LastPush, NumBytes)) {
259 if (LastPush == FramePtrPush)
260 FramePtrOffsetInPush += NumBytes;
261 } else
261262 emitSPUpdate(isARM, MBB, MBBI, dl, TII, -NumBytes,
262263 MachineInstr::FrameSetup);
263264
136136 ; CHECK: {{LBB[0-9]+_2}}:
137137 ; CHECK-NEXT: vpop {d7, d8}
138138 ; CHECK-NEXT: pop {r4, pc}
139
140 ; With a guaranteed frame-pointer, we want to make sure that its offset in the
141 ; push block is correct, even if a few registers have been tacked onto a later
142 ; vpush (PR18160).
143 ; CHECK-IOS-LABEL: test_fold_point:
144 ; CHECK-IOS: push {r4, r7, lr}
145 ; CHECK-IOS-NEXT: add r7, sp, #4
146 ; CHECK-IOS-NEXT: vpush {d7, d8}
147
139148 ; We want some memory so there's a stack adjustment to fold...
140149 %var = alloca i8, i32 8
141150