Displaying 1 result from an estimated 1 matches for "getelementvalue".
2014 Jan 29
2
[LLVMdev] getelementptr on static const struct
Hi,
I found a mysterious behavior of LLVM optimizer.
I compiled the following code by clang -emit-llvm -S:
#include <stddef.h>
static const struct t {char t[4]; char s;} p = {{}, 'a'};
char f() {
return ((char*)&p)[offsetof(struct t, s)];
}
then I obtained the following LLVM IR:
%struct.t = type { [4 x i8], i8 }
@p = constant %struct.t { [4 x i8] zeroinitializer, i8 97