Displaying 2 results from an estimated 2 matches for "iedke_".
Did you mean:
idkey
2020 Jul 09
2
Understand alias-analysis results
Hello,
I am performing alias analysis toward the following simple code:
struct MyStruct {
int * f1;
int * f2;
};
void NOALIAS(void* p, void* q){
}
int main() {
struct MyStruct s[2];
int a,b;
s[0].f1 = &a;
s[1].f1 = &b;
NOALIAS(s[a].f1, s[b].f2);
return 0;
}
When I use the following command to generate .bc code and conduct alias
analysis:
clang -c -emit-llvm t.c -O2
opt -basicaa
2020 Jul 09
2
Understand alias-analysis results
...g circumstances: [...] The
> value of an object with automatic storage duration is used while it is
> indeterminate").
>
> As such, you can notice that most of the code is going to be optimized
> away between mem2reg and dead argument elimination:
> https://llvm.godbolt.org/z/iEdKE_
>
> (Similarly, even if `a` and `b` were initialized to `0`, we only wrote
> to `f1` for `s[0]` and `s[1]`, so accessing `s[b].f2` is again using an
> object while it is indeterminate and undefined behavior.)
>
> *** IR Dump After Promote Memory to Register ***
>
> ; the fol...