[LLVMdev] getelementptr with dynamic index

Duncan Sands baldrick at free.fr
Thu Sep 15 07:15:26 PDT 2011


> the following llvm-ir is manipulated by the optimizers:
> %target2 = getelementptr %.string %result, i32 0, i32 3, i32 %len1
> (%_.string = type {i32, i32, i32, [0 x i8]})
> the last parameter i32 %len1 is replaced by i32 0 by the optimizers. (both, 2.9
> and 2.8). When i turn optmization off, it works correctly.
> How can i use an optimizer-safe dynamic indexing of arrays?

there is not enough information to say why the optimizers are doing this.
Please send a complete testcase.

Ciao, Duncan.

More information about the llvm-dev mailing list