<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Different code generation at -O2 -g and -O2"
   href="http://llvm.org/bugs/show_bug.cgi?id=18590">18590</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Different code generation at -O2 -g and -O2
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DebugInfo
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>katya_romanova@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>r123031 introduced this regression.`

Consider the following testcase:
==============
struct Foo {
  bool bar();
  bool operator==(Foo &baz) { return (this == &baz); }
};
Foo *wibble;
bool Foo::bar() { return (*this == *wibble); }
int main() {}
============== 

clang -O2 -g test.cpp -o test.g.o
clang -O2 test.cpp -o test.o

As you can see below, "-g" inhibits the removal of a mov instruction.


objdump -D -j .text -D test.g.o 
Disassembly of .text shows:

00000000004004d0 <_ZN3Foo3barEv>:
  4004d0:       48 8b 05 51 0b 20 00    mov    0x200b51(%rip),%rax        #
601028 <wibble>
  4004d7:       48 39 f8                cmp    %rdi,%rax
  4004da:       0f 94 c0                sete   %al
  4004dd:       c3                      retq
  4004de:       66 90                   xchg   %ax,%ax


objdump -D -j .text -D test.o 
Disassembly of .text shows:

00000000004004d0 <_ZN3Foo3barEv>:
  4004d0:       48 39 3d 51 0b 20 00    cmp    %rdi,0x200b51(%rip)        #
601028 <wibble>
  4004d7:       0f 94 c0                sete   %al
  4004da:       c3                      retq
  4004db:       0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)


Checking for "isDebugValue()" in r123031 code effects code generation in our
test cases above. Removing the isDebugValue() checks from MachineInstr.cpp and
PeepholeOptimizer.cpp takes care of the code generation differences, but
several DebugInfo tests start to fail.

Katya.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>