[LLVMbugs] [Bug 22527] New: More optimize opportunity
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Feb 9 18:22:15 PST 2015
http://llvm.org/bugs/show_bug.cgi?id=22527
Bug ID: 22527
Summary: More optimize opportunity
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: ishiura-compiler at ml.kwansei.ac.jp
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
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","", at 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,"", at progbits
--
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/20150210/b33e333d/attachment.html>
More information about the llvm-bugs
mailing list