[LLVMdev] Anderson's analysis, getresult instruction on x86_64

Daniel Berlin dberlin at dberlin.org
Mon Aug 4 22:42:42 PDT 2008

On Tue, Aug 5, 2008 at 12:16 AM, Prakash Prabhu
<prakash.prabhu at gmail.com> wrote:
> Hi,
> I was trying to run Anderson's pointer analysis using opt on a 64 bit x86
> system (running Ubuntu 8.04) and it seems that the 'getresult' instruction
> is not currently handled. When I run the same analysis on the bitcode got by
> compiling (using llvm-gcc on a 32 bit machine) on a 32-bit x86 machine, it
> runs fine. I was trying to see if it is possible to quickly add a
> 'visitGetResultInst' to Andersons.cpp but could not quite find the right
> constraint to add to the pointer analysis. Can a instruction like :
> %mrv_gr = getresult { i64*, i64* } %74, 0
> be modelled as a load/store/getelementpointer and a
> Constraint::Load/Store/Copy be added to handle this case ?

Sure, it is equivalent to a copy from the function result.

> Right now though, the opt crash in my case seems to be due to getresult that
> does not access pointers (i am guessing from {i64, i64} type though i may be
> wrong):

Ignoring non-pointers in every single case is an optimization, it is
not required for correctness.
We do in most cases, but it is harder in cases like structs, etc,
because they may contain pointers and it generally takes more time to
ignore the resulting constraints than it does to process them.

More information about the llvm-dev mailing list