[LLVMbugs] [Bug 3326] New: missed optimization with -m32: empty functions shouldn' t contain push/mov/pop

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Jan 15 01:25:30 PST 2009


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

           Summary: missed optimization with -m32: empty functions shouldn't
                    contain push/mov/pop
           Product: new-bugs
           Version: unspecified
          Platform: PC
               URL: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38854
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: edwintorok at gmail.com
                CC: llvmbugs at cs.uiuc.edu


LLVM exhibits same missed optimization as gcc with -m32.

Testcase:
void noop(char* foo) {}

$ llvm-gcc -O2 x.c -S -m32
noop:
        pushl   %ebp
        movl    %esp, %ebp
        popl    %ebp
        ret

It shouldn't contain the push/mov/pop, and indeed without -m32 it doesn't:
noop:
.Leh_func_begin1:
.Llabel1:
        ret

However I can't reproduce this with
llvm-gcc -S -emit-llvm -m32 -O2 | llvm-as | llc -march=x86

I tried -mcpu=i486 too.

Is gcc still using LLVM for code generation with -m32?

What is special in llvm-gcc's invocation of the code generator?

Here is the bitcode, and llc correctly generates the code w/o push/mov/pop

target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i386-unknown-linux-gnu"

define void @noop(i8* nocapture %foo) nounwind readnone {
entry:
        ret void
}

Both llvm and llvm-gcc were compiled from same revision (r62238).


-- 
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