[LLVMdev] Fusing GEPIs

Mattias Holm holm at liacs.nl
Thu May 14 03:25:07 PDT 2009


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




More information about the llvm-dev mailing list