[LLVMbugs] [Bug 2964] New: Prolog/Epilog Insertion going crazy on PPC

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Oct 27 23:53:39 PDT 2008


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

           Summary: Prolog/Epilog Insertion going crazy on PPC
           Product: libraries
           Version: 1.0
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: code-quality
          Severity: normal
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: clattner at apple.com
                CC: llvmbugs at cs.uiuc.edu


go into test/CodeGen/PowerPC and do this:

$ llvm-as < compare-fcmp-ord.ll | llvm-extract -func test | llc -march=ppc32
-print-machineinstrs -debug-pass=Executions | & less

Before PEI, the code looks like this:

entry: 0x1812ab4, LLVM BB @0x14021a0, ID#0:
Live Ins: %F1 %F2
        %CR7<def> = FCMPUD %F1<kill>, %F2<kill>
        %R2<def> = MFCR %CR0<imp-use,kill>, %CR1<imp-use,kill>,
%CR2<imp-use,kill>, %CR3<imp-use,kill>, 
%CR4<imp-use,kill>, %CR5<imp-use,kill>, %CR6<imp-use,kill>, %CR7<imp-use,kill>
        %R3<def> = RLWINM %R2, 29, 31, 31
        %R2<def> = RLWINM %R2<kill>, 31, 31, 31
        %R3<def> = OR %R2<kill>, %R3<kill>
        BLR 20, %reg0, %R3<imp-use,kill>, %LR<imp-use>

Afterwards, it looks like this:

entry: 0x1812ab4, LLVM BB @0x14021a0, ID#0:
Live Ins: %F1 %F2 %CR2 %CR3 %CR4
        %R0<def> = MFCR %CR0<imp-use>, %CR1<imp-use>, %CR2<imp-use>,
%CR3<imp-use>, %CR4<imp-use>, %CR5<
imp-use>, %CR6<imp-use>, %CR7<imp-use>
        %R0<def> = RLWINM %R0, 8, 0, 31
        STW %R0<kill>, -4, %R1
        %R0<def> = MFCR %CR0<imp-use>, %CR1<imp-use>, %CR2<imp-use>,
%CR3<imp-use>, %CR4<imp-use>, %CR5<
imp-use>, %CR6<imp-use>, %CR7<imp-use>
        %R0<def> = RLWINM %R0, 12, 0, 31
        STW %R0<kill>, -8, %R1
        %R0<def> = MFCR %CR0<imp-use>, %CR1<imp-use>, %CR2<imp-use>,
%CR3<imp-use>, %CR4<imp-use>, %CR5<
imp-use>, %CR6<imp-use>, %CR7<imp-use>
        %R0<def> = RLWINM %R0, 16, 0, 31
        STW %R0<kill>, -12, %R1
        %CR7<def> = FCMPUD %F1<kill>, %F2<kill>
        %R2<def> = MFCR %CR0<imp-use,kill>, %CR1<imp-use,kill>,
%CR2<imp-use,kill>, %CR3<imp-use,kill>, 
%CR4<imp-use,kill>, %CR5<imp-use,kill>, %CR6<imp-use,kill>, %CR7<imp-use,kill>
        %R3<def> = RLWINM %R2, 29, 31, 31
        %R2<def> = RLWINM %R2<kill>, 31, 31, 31
        %R3<def> = OR %R2<kill>, %R3<kill>
        %R0<def> = LWZ -12, %R1
        %R0<def> = RLWINM %R0, 16, 0, 31
        %CR4<def> = MTCRF %R0
        %R0<def> = LWZ -8, %R1
        %R0<def> = RLWINM %R0, 20, 0, 31
        %CR3<def> = MTCRF %R0
        %R0<def> = LWZ -4, %R1
        %R0<def> = RLWINM %R0, 24, 0, 31
        %CR2<def> = MTCRF %R0
        BLR 20, %reg0, %R3<imp-use,kill>, %LR<imp-use>


This is a huge code quality regression from the past.  It looks like
individuals CR is being saved and restored.  CR7 (which is def'd by this code)
is a call clobber register according to this:

PPCInstrInfo.td:422.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list