[LLVMdev] the generation of getelementptr instruction
ChristophErhardt at gmx.de
Thu Jul 22 00:13:58 PDT 2010
> I'm reading the language reference of LLVM here:
> 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?
if you enable optimizations in the frontend (-O1), the resulting LLVM
code will look just as shown in the example.
More information about the llvm-dev