[llvm-bugs] [Bug 40969] New: more compact sequence of x86 movs generated when using -g

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 5 12:10:58 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40969

            Bug ID: 40969
           Summary: more compact sequence of x86 movs generated when using
                    -g
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: greg.bedwell at sony.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
            Blocks: 37728

In response to this llvm-dev post:
http://lists.llvm.org/pipermail/llvm-dev/2019-March/130779.html

Here is an example using the check-cfc tool (
https://github.com/llvm/llvm-project/tree/master/clang/utils/check_cfc ) to
spot a codegen difference depending on whether -g is specified or not.  The
reduced source example is a little bit nasty as there's some dodgy looking
pointer casting in there, but regardless the absence or presence of -g should
not make a difference to generated code.

Here's my check_cfc.cfg file contents:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Checks]
dash_g_no_change = true
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and here it is in action:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ clang -v
Check CFC, checking: dash_g_no_change
clang version 9.0.0 (trunk 355410) (llvm/trunk 355412)
Target: x86_64-scei-ps4
Thread model: posix
InstalledDir: E:\work\upstream-llvm\build-vs2015-ps4-ninja\bin

$ cat 1.cpp

using alpha = float __attribute__((ext_vector_type(4)));

void bravo(alpha charlie) {
  unsigned char *delta = (unsigned char *)&charlie;
  delta[0] = 0;
  volatile alpha echo = charlie;
}

$ clang -c 1.cpp -O2 -g -fno-strict-aliasing --target=x86_64-unknown-unknown
Check CFC, checking: dash_g_no_change
1.cpp Code difference detected with -g
--- c:\tmp\gnochange\example\tmp\tmp_v5akp.o

+++ c:\tmp\gnochange\example\tmp\tmpvhabwu.o

@@ -5,6 +5,6 @@

 0x00000001: 48 89 E5                mov      rbp,rsp
 0x00000004: 0F 29 45 F0             movaps   xmmword ptr [rbp-10h],xmm0
 0x00000008: C6 45 F0 00             mov      byte ptr [rbp-10h],0
-0x0000000C: 0F 28 45 F0             movaps   xmm0,xmmword ptr [rbp-10h]
-0x00000010: 0F 29 45 E0             movaps   xmmword ptr [rbp-20h],xmm0
-0x00000014: 5D                      pop      rbp
+0x0000000C: 8A 45 F0                mov      al,byte ptr [rbp-10h]
+0x0000000F: 88 45 E0                mov      byte ptr [rbp-20h],al
+0x00000012: 48 8B 45 F1             mov      rax,qword ptr [rbp-0Fh]
*** Diff truncated ***
~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Referenced Bugs:

https://bugs.llvm.org/show_bug.cgi?id=37728
[Bug 37728] [meta] Make llvm passes debug info invariant
-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190305/198868f5/attachment.html>


More information about the llvm-bugs mailing list