[LLVMdev] Reassociating expressions involving GEPs

Eli Friedman eli.friedman at gmail.com
Fri Jan 30 15:14:44 PST 2009


On Fri, Jan 30, 2009 at 3:03 PM, Stefanus Du Toit
<stefanus.dutoit at rapidmind.com> wrote:
> The computation of %base then becomes loop-invariant and can be lifted out.
>
> What's the best way to add this optimization to LLVM?

Probably the best place is LICM itself... only loop transformations
are aware whether something is loop-invariant.

Although, I'm not completely sure the transformation is safe, at least
the way you're stating it; unlike add, GEP has undefined overflow, so
this isn't right in cases like %call == %tmp4 == INT_MIN.

-Eli



More information about the llvm-dev mailing list