Skip to content

Need a machine code LICM pass #1265

@llvmbot

Description

@llvmbot
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

No one assigned

    Labels

    bugzillaIssues migrated from bugzillacode-qualityenhancementImproving things as opposed to bug fixing, e.g. new or missing featurellvm:codegen

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions