It seems that this optimization should not be performed when strict aliasing is disabled. However, GCC is being aggressive and performs speculative loads on struct fields even with-fno-strict-aliasing.
Should LLVM perform this load speculation even with strict aliasing disabled?
If no, what is the way to check for strict aliasing in the midend (with strict aliasing being a frontend concept)? Is it reasonable to check for presence of TBAA tags on the load instructions? And if there are any TBAA tags associated with loads, consider strict aliasing enabled.