[LLVMbugs] [Bug 893] NEW: Using the address of a global isn't necessarily cheap.
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Wed Aug 30 09:10:08 PDT 2006
http://llvm.org/bugs/show_bug.cgi?id=893
Summary: Using the address of a global isn't necessarily cheap.
Product: libraries
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P2
Component: Loop Optimizer
AssignedTo: unassignedbugs at nondot.org
ReportedBy: alenhar2 at uiuc.edu
On some architectures (and PIC modes) using the address of a global variable is
not cheap (sometimes involving a load). Thus the global should be hoisted out
of loops. This is probably true of large constants that the target will wind up
spilling to the constant pool also.
Thus LICM (and probably instcombine and such) should be aware of this (informed
by target data I'm sure).
consider:
%GV = internal global int 0
...
cond_true:
%b = call foo(int* %GV,...)
br bool %b, %cond_true, %cond_false
here the passing of GV causes an extra load each iteration of the loop. This is
bad.
------- 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