This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/46265] New: Missing ifcvt
- From: "xinliangli at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 2 Nov 2010 00:37:10 +0000
- Subject: [Bug rtl-optimization/46265] New: Missing ifcvt
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46265
Summary: Missing ifcvt
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: xinliangli@gmail.com
Compile the following code with -O2
int *gp;
int g, g2;
int foo(int p)
{
int t = 0;
if (p)
t = *gp + 1;
return (*gp + t);
}
Trunk gcc produces:
movq gp(%rip), %rax
xorl %edx, %edx
movl (%rax), %eax
testl %edi, %edi
je .L3
leal 1(%rax), %edx
.L3:
addl %edx, %eax
ret
llvm (with clang) produces:
movq gp(%rip), %rax
movl (%rax), %ecx
leal 1(%rcx), %edx
testl %edi, %edi
movl $0, %eax
cmovnel %edx, %eax
addl %ecx, %eax
ret
Gcc's ifcvt seems weak. If changing t=*gp + 1 to t = g then the assignment can
be ifcvted by gcc.
David