[LLVMdev] the generation of getelementptr instruction

Eli Friedman eli.friedman at gmail.com
Thu Jul 22 00:04:13 PDT 2010

2010/7/21 Wenbin Zhang <zhangwen at cse.ohio-state.edu>:
> Hi all,
> I'm reading the language reference of LLVM here:
> http://llvm.org/docs/LangRef.html#i_getelementptr
> In the first example, it shows that the generated IR is supposed to be
> something like:
> %reg = getelementptr %ST* %s, i32 1, i32 2, i32 1, i32 5, i32 13
> But when I copied the code and compile it myself (using v2.7), I got five
> getelementptr instructions, which are just like the equivalent code given
> later in the document.
> In the case above, why the resulting IRs are different?
> Thanks a lot.

Just a quirk of frontend code generation; you'll get the shown result with -O.


More information about the llvm-dev mailing list