diff options
author | Tim Northover <tnorthover@apple.com> | 2013-12-08 08:12:20 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2013-12-08 08:12:20 +0000 |
commit | e8098892f517c492193f8f8ebdcbb861d7a7b54a (patch) | |
tree | e42e27dc1a48051ae60b8ceaf5f6112eb3478de1 | |
parent | 209178dacacb5c254926a9d8c72933f23feced9f (diff) | |
download | external_llvm-e8098892f517c492193f8f8ebdcbb861d7a7b54a.zip external_llvm-e8098892f517c492193f8f8ebdcbb861d7a7b54a.tar.gz external_llvm-e8098892f517c492193f8f8ebdcbb861d7a7b54a.tar.bz2 |
Merging r196493. Simple conflict due to change API of updated
function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@196717 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/ARM/ARMFrameLowering.cpp | 7 | ||||
-rw-r--r-- | test/CodeGen/ARM/fold-stack-adjust.ll | 29 |
2 files changed, 30 insertions, 6 deletions
diff --git a/lib/Target/ARM/ARMFrameLowering.cpp b/lib/Target/ARM/ARMFrameLowering.cpp index 3e72d36..1457ace 100644 --- a/lib/Target/ARM/ARMFrameLowering.cpp +++ b/lib/Target/ARM/ARMFrameLowering.cpp @@ -380,15 +380,10 @@ void ARMFrameLowering::emitEpilogue(MachineFunction &MF, if (NumBytes != 0) emitSPUpdate(isARM, MBB, MBBI, dl, TII, NumBytes); } else { - MachineBasicBlock::iterator FirstPop = MBBI; - // Unwind MBBI to point to first LDR / VLDRD. const uint16_t *CSRegs = RegInfo->getCalleeSavedRegs(&MF); if (MBBI != MBB.begin()) { do { - if (isPopOpcode(MBBI->getOpcode())) - FirstPop = MBBI; - --MBBI; } while (MBBI != MBB.begin() && isCSRestore(MBBI, TII, CSRegs)); if (!isCSRestore(MBBI, TII, CSRegs)) @@ -434,7 +429,7 @@ void ARMFrameLowering::emitEpilogue(MachineFunction &MF, ARM::SP) .addReg(FramePtr)); } - } else if (NumBytes && !tryFoldSPUpdateIntoPushPop(MF, FirstPop, NumBytes)) + } else if (NumBytes && !tryFoldSPUpdateIntoPushPop(MF, MBBI, NumBytes)) emitSPUpdate(isARM, MBB, MBBI, dl, TII, NumBytes); // Increment past our save areas. diff --git a/test/CodeGen/ARM/fold-stack-adjust.ll b/test/CodeGen/ARM/fold-stack-adjust.ll index 8bda768..8c60bca 100644 --- a/test/CodeGen/ARM/fold-stack-adjust.ll +++ b/test/CodeGen/ARM/fold-stack-adjust.ll @@ -124,3 +124,32 @@ define arm_aapcs_vfpcc double @check_vfp_no_return_clobber() minsize { ret double 1.0 } + +@dbl = global double 0.0 + +; PR18136: there was a bug determining where the first eligible pop in a +; basic-block was when the entire block was epilogue code. +define void @test_fold_point(i1 %tst) minsize { +; CHECK-LABEL: test_fold_point: + + ; Important to check for beginning of basic block, because if it gets + ; if-converted the test is probably no longer checking what it should. +; CHECK: {{LBB[0-9]+_2}}: +; CHECK-NEXT: vpop {d7, d8} +; CHECK-NEXT: pop {r4, pc} + ; We want some memory so there's a stack adjustment to fold... + %var = alloca i8, i32 8 + + ; We want a long-lived floating register so that a callee-saved dN is used and + ; there's both a vpop and a pop. + %live_val = load double* @dbl + br i1 %tst, label %true, label %end +true: + call void @bar(i8* %var) + store double %live_val, double* @dbl + br label %end +end: + ; We want the epilogue to be the only thing in a basic block so that we hit + ; the correct edge-case (first inst in block is correct one to adjust). + ret void +}
\ No newline at end of file |