[LLVMdev] Fusing GEPIs

Dan Gohman gohman at apple.com
Thu May 14 10:39:16 PDT 2009


An alternative to manually analyzing GEPs is to use the ScalarEvolution
pass. In TOT, ScalarEvolution will automatically analyze chains of GEPs
and other things, and present them in a normalized form. One of
the intentions of this is to support clients that want to understand
memory access patterns.

Given a LoadInst or StoreInst, ask ScalarEvolution for the SCEV  
expression
for the address operand. Among other things, that indicates which loops
affect the address' value and what the strides are from each loop.

Dan

On May 14, 2009, at 3:25 AM, Mattias Holm wrote:

> Hi,
>
> Is there any standard pass or something that can fuse chained GEPIs?
>
> I.e. turning
> 	b = getelementptr a, 10, 1
> 	c = getelementptr b, 0, 3
> 	d = getelementptr c, 0, 5
> into:
> 	d = getelementptr a, 10, 1, 3, 5
>
> In our case this would greatly simplify some analysis passes, at the
> moment we have to trace back a gepi-chain and extract all the indices
> manually (the original object is available through the
> getUnderlyingObject method, so that doesn't pose any problems).
>
>
> Kind regards,
> Mattias
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list