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

            Bug ID: 19483
           Summary: Clang should include more information about the target
                    in the IR to help reproducing issues
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Created attachment 12409
  --> http://llvm.org/bugs/attachment.cgi?id=12409&action=edit
An example

It would be nice if we could have the exact same codegen from ‘clang -S’ and
'clang -S -emit-llvm | llc’.

Currently, clang sets the triple information and some function attributes in
the IR file, but this is not enough. In particular, the target features as well
as the cpu are important pieces of information that are missing.

One can get this information with 'clang -v’, but this does not fit nicely in
the work flow.

I’ve attached an example that demonstrates that on MacOS X:
clang -O3 -S -o orig.s reproduce.c -arch x86_64h
clang -O3 -S -o - reproduce.c -arch x86_64h -emit-llvm | llc -o new.s
diff -U 10 orig.s new.s
--- orig.s    2014-04-18 16:53:31.000000000 -0700
+++ new.s    2014-04-18 16:52:56.000000000 -0700
@@ -6,20 +6,20 @@
     .cfi_startproc
 ## BB#0:                                ## %entry
     pushq    %rbp
 Ltmp0:
     .cfi_def_cfa_offset 16
 Ltmp1:
     .cfi_offset %rbp, -16
     movq    %rsp, %rbp
 Ltmp2:
     .cfi_def_cfa_register %rbp
-    vxorps    %xmm0, %xmm0, %xmm0
-    vxorps    %xmm1, %xmm1, %xmm1
-    vxorps    %xmm2, %xmm2, %xmm2
-    vxorps    %xmm3, %xmm3, %xmm3
+    xorps    %xmm0, %xmm0
+    xorps    %xmm1, %xmm1
+    xorps    %xmm2, %xmm2
+    xorps    %xmm3, %xmm3
     popq    %rbp
     jmp    _bar                    ## TAILCALL
     .cfi_endproc

clang -O3 -S -o orig.s reproduce.c -arch arm64
clang -O3 -S -o - reproduce.c -arch arm64 -emit-llvm | llc -o new.s
diff -U 10 orig.s new.s
--- orig.s    2014-04-18 17:11:18.000000000 -0700
+++ new.s    2014-04-18 17:11:53.000000000 -0700
@@ -1,14 +1,14 @@
     .section    __TEXT,__text,regular,pure_instructions
     .ios_version_min 5, 0
     .globl    _foo
     .align    2
 _foo:                                   ; @foo
 ; BB#0:                                 ; %entry
-    movi.2d    v0, #0000000000000000
-    movi.2d    v1, #0000000000000000
-    movi.2d    v2, #0000000000000000
-    movi.2d    v3, #0000000000000000
+    fmov    d0, xzr
+    orr.16b    v1, v0, v0
+    orr.16b    v2, v0, v0
+    orr.16b    v3, v0, v0
     b    _bar


 .subsections_via_symbols

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