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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to