[LLVMbugs] [Bug 14019] New: "-S" and "-emit-llvm | llc" produce different assembly?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 4 07:11:29 PDT 2012


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

             Bug #: 14019
           Summary: "-S" and "-emit-llvm | llc" produce different
                    assembly?
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Driver
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: timurrrr at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


As of r165016,

$ cat hello.c
void f() {}

void hello() {
  int x;
  x = 42;
  f();
}

-----------
Running these three commands to generate output files:
$ clang hello.c -Xclang -triple=i386-pc-win32 -o - -S            >a
$ clang -cc1 -triple=i386-pc-win32 hello.c -o - -emit-llvm | llc >b
$ clang -cc1 hello.c -triple=i386-pc-win32 -o - -emit-llvm -S    >c

# FTR, the outputs don't change in the presence of "-cxx-abi microsoft".

Comparing the output:
$ diff -u a b
--- a
+++ b
@@ -17,13 +17,10 @@
        .align  16, 0x90
 _hello:                                 # @hello
 # BB#0:                                 # %entry
-       pushl   %ebp
-       movl    %esp, %ebp
        pushl   %eax
-       movl    $42, -4(%ebp)
+       movl    $42, (%esp)
        calll   _f
-       addl    $4, %esp
-       popl    %ebp
+       popl    %eax
        ret

$ diff -u b c
<assembly is the same, only the comments differ a bit>

-----------
Can you explain the major difference between (a) and (b,c) ?
Is it a bug or it's meant to be this way? If it's the latter - why?

What should I look at while testing what assembly Clang generates for my source
code?

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