-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillacode-qualityenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing featurellvm:codegen
Description
| Bugzilla Link | 893 |
| Resolution | FIXED |
| Resolved on | Apr 22, 2009 04:28 |
| Version | 1.0 |
| OS | All |
| Reporter | LLVM Bugzilla Contributor |
| CC | @isanbard |
Extended Description
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.
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillacode-qualityenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing featurellvm:codegen