[LLVMbugs] [Bug 18590] New: Different code generation at -O2 -g and -O2

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jan 23 01:29:44 PST 2014


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

            Bug ID: 18590
           Summary: Different code generation at -O2 -g and -O2
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: katya_romanova at playstation.sony.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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.

-- 
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/20140123/61f33c37/attachment.html>


More information about the llvm-bugs mailing list