[Bug optimization/13629] New: [tree-ssa][Regression] dominator optimizations can pessimize code
steven at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Jan 9 12:12:00 GMT 2004
If an expression dominates another one on a path, the redundant
expression is always eliminated. This can pessimize the code
if the original expression was dead code:
int *data;
void partial_dead (int i, int j)
{
int k = i * j;
if (i & j)
data[0] = i * j;
}
-->
;; Function partial_dead (partial_dead)
partial_dead (i, j)
{
int k;
<bb 0>:
k = i * j;
if ((i & j) != 0) goto <L0>; else goto <L1>;
<L0>:;
*data = k;
<L1>:;
return;
}
This is, in fact, a regression:
Resulting assembly with tree-ssa:
partial_dead:
movl 4(%esp), %edx # i
movl 8(%esp), %eax # j
movl %edx, %ecx # k = i
imull %eax, %ecx # k = i * j
testl %eax, %edx # if (j & i)
je .L1 # goto <L1>
movl data, %eax
movl %ecx, (%eax) # *data = k
.L1:
ret
Resulting assembly with 3.3.1 (SuSE Linux):
partial_dead:
movl 4(%esp), %edx # i
movl 8(%esp), %eax # j
testl %eax, %edx # if (j & i)
je .L1 # goto <L1>
imull %eax, %edx
movl data, %eax
movl %edx, (%eax) # *data = i * j
.L1:
ret
--
Summary: [tree-ssa][Regression] dominator optimizations can
pessimize code
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Keywords: pessimizes-code
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: steven at gcc dot gnu dot org
CC: dnovillo at redhat dot com,gcc-bugs at gcc dot gnu dot
org,law at redhat dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13629
More information about the Gcc-bugs
mailing list