[LLVMbugs] [Bug 864] NEW: LSR should emit expressions in proper order for CSE to happen
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Wed Aug 2 23:18:45 PDT 2006
http://llvm.org/bugs/show_bug.cgi?id=864
Summary: LSR should emit expressions in proper order for CSE to
happen
Product: libraries
Version: 1.0
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: Scalar Optimizations
AssignedTo: unassignedbugs at nondot.org
ReportedBy: sabre at nondot.org
CC: natebegeman at mac.com
Consider:
int foo(int X, int Y, int Z, int* P1, int* P2, int* P3, int* P4) {
int i;
for (i = 0; i != 1000; ++i) {
int t = *P3;
int t2 = i*4+t;
*P1 = t2+X;
*P2 = t2+Y;
}
}
LSR breaks down the two expression uses (the sstore to P1/P2) into stores two two different loop
invariant bases (X and Y), and then inserts code for each base. Unfortunately, it inserts the expressions
with this order of operations:
*P1 = (i*4+X)+t;
*P2 = (i*4+Y)+t;
Because of this, it is implicitly un-CSE-ing the add "i*4+t", causing the output machine code two have
two adds for this op.
-Chris
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the llvm-bugs
mailing list