Displaying 1 result from an estimated 1 matches for "tfgnig".
Did you mean:
taguig
2020 Jun 19
2
Aliasing and forwarding optimization
...est1(struct st1 * ptr1 , struct st2 * ptr2, struct st2 *ptr3) {
ptr1->a = 10;
*ptr3 = *ptr2;
return ptr1->a;
}
--Snip---
For the above case GCC is able to store forward the value 10 to the return
place.
LLVM is not doing this.
GCC
https://godbolt.org/z/FCjCXy
LLVM
https://godbolt.org/z/TFgnig
My understanding is that under strict aliasing rules accessing objects of
different types don't alias.
In this case we are accessing "struct st2" object and "int" type
object. so aliasing should not prevent the forwarding of store 10 to the
return place .
Can someone plea...