<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 --- - More optimize opportunity"
   href="http://llvm.org/bugs/show_bug.cgi?id=22527">22527</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>More optimize opportunity
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ishiura-compiler@ml.kwansei.ac.jp
          </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>We would just like to report that GCC (4.9.2, -O3) does stronger 
optimization than Clang (3.7.0, -O3) on the following C code.
Evaluation of the arith expression (involving volatile variable a) 
is optimized out by GCC.

int main (void)
{
  volatile unsigned int a = 1U;

  unsigned long c = (a + 0x80000000LU) * 0xFFFFFFFFFFFFFFFELU;

  if (c == 0xFFFFFFFEFFFFFFFELU) ;
  else __builtin_abort();

  return 0;
}

LLVM/Clang-3.7.0 "-O3 -S"

main:                                   # @main
  .cfi_startproc
# BB#0:                                 # %entry
  pushq    %rax
.Ltmp0:
  .cfi_def_cfa_offset 16
  movl     $1, 4(%rsp)
  movl     4(%rsp), %eax
  movq     $-2147483648, %rcx           # imm = 0xFFFFFFFF80000000
  subq     %rax, %rcx
  movabsq  $9223372036854775807, %rax   # imm = 0x7FFFFFFFFFFFFFFF
  andq     %rcx, %rax
  movabsq  $9223372034707292159, %rcx   # imm = 0x7FFFFFFF7FFFFFFF
  cmpq     %rcx, %rax
  jne      .LBB0_2
# BB#1:                                 # %if.end
  xorl     %eax, %eax
  popq     %rdx
  retq
.LBB0_2:                                # %if.else
  callq    abort
.Ltmp1:
  .size  main, .Ltmp1-main
  .cfi_endproc

  .ident  "clang version 3.7.0 (trunk 228120)"
  .section  ".note.GNU-stack","",@progbits


GCC-4.9.2 "-O3 -S"

main:
.LFB0:
  .cfi_startproc
  subq     $24, %rsp
  .cfi_def_cfa_offset 32
  movl     $1, 12(%rsp)
  movl     12(%rsp), %eax
  cmpl     $1, %eax
  jne      .L5
  xorl     %eax, %eax
  addq     $24, %rsp
  .cfi_remember_state
  .cfi_def_cfa_offset 8
  ret
.L5:
  .cfi_restore_state
  call     abort
  .cfi_endproc
.LFE0:
  .size  main, .-main
  .section  .text.unlikely
.LCOLDE0:
  .section  .text.startup
.LHOTE0:
  .ident  "GCC: (GNU) 4.9.2"
  .section  .note.GNU-stack,"",@progbits</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>