[LLVMbugs] [Bug 18136] New: [ARM Backend]Rewinding to first LDR/VLDRD should use reverse_iterator when emitting epiloge

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Dec 4 11:27:55 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=18136

            Bug ID: 18136
           Summary: [ARM Backend]Rewinding to first LDR/VLDRD should use
                    reverse_iterator when emitting epiloge
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: zhaoshiz at codeaurora.org
                CC: llvmbugs at cs.uiuc.edu, t.p.northover at gmail.com
    Classification: Unclassified

Given an MBB like this, currently LLVM stops at t2LDMIA_RET.

(gdb) call MBB.dump()
BB#52: derived from LLVM BB %return
    Predecessors according to CFG: BB#0 BB#51
    %SP<def,tied1> = VLDMDIA_UPD %SP<tied0>, pred:14, pred:%noreg, %D8<def>,
%D9<def>, %D10<def>, %D11<def>, %D12<def>
    %SP<def,tied1> = t2LDMIA_RET %SP<tied0>, pred:14, pred:%noreg, %R4<def>,
%R5<def>, %R6<def>, %R7<def>, %R8<def>, %R9<def>, %R10<def>, %R11<def>,
%PC<def>

lib/Target/ARM/ARMFrameLowering.cpp:385
    // 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))
        ++MBBI;
    }

With MinSize attribute (-Oz), folding SP update into pop results in misaligned
register values stored in stack.

>     aa6:	b001      	add	sp, #4
>     aa8:	ecbd 8b0a 	vpop	{d8-d12}
>     aac:	e8bd 8ff0 	ldmia.w	sp!, {r4, r5, r6, r7, r8, r9, sl, fp, pc}

becomes:

>     a9e:	ecbd 8b0a 	vpop	{d8-d12}
>     aa2:	e8bd 8ff8 	ldmia.w	sp!, {r3, r4, r5, r6, r7, r8, r9, sl, fp, pc}

Related bug: http://llvm.org/bugs/show_bug.cgi?id=18081

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131204/7941d6bf/attachment.html>


More information about the llvm-bugs mailing list