[LLVMdev] Is GEP safe if not know the size of an array?
t.p.northover at gmail.com
Mon Sep 16 09:17:30 PDT 2013
> So, is there any problem? Not safe, or just not good but basically OK?
It's probably safe (at least on non-exotic targets, and probably
universally). But the canonical way to do it would probably be to use
the first index and offset the i32* directly:
%v1 = alloca i32
store i32 5, i32* %v1
%6 = load i32* %v1
%7 = getelementptr i32* %v0, i32 %6
%8 = load i32* %7
store i32 %8, i32* %v0
More information about the llvm-dev