[LLVMdev] Question on Load and GetElementPtr instructions

Duncan Sands baldrick at free.fr
Fri Jun 18 05:42:07 PDT 2010


Hi Xiaolong,

> Considering the following instruction:
>
>    %20 = load %struct.Node** getelementptr inbounds (%struct.Node*
>            @head, i32 0, i32 0), align 16 ;<%struct.Node*>  [#uses=1]
>
> What is the type of the first operand of the instruction (i.e.,
> getOperand(0))?
>
> I thought the operand is a "GetElementPtr" instruction, however, the
> predicate "isa<Instruction>()" over the operand returns false.
> So, I am confused. Can someone clarify the above instruction for me?

it is not an Instruction, it is a ConstantExpr.  Several expressions like
GEP exist both as instructions and as constants, see the ConstantExpr class.

Ciao,

Duncan.



More information about the llvm-dev mailing list