There are several optimizations when we try to load speculatively. There are also two similar functions to determine whether it's a safe transformation:
Once we have D9791in place, we can unify these two functions. With this change isSafeToLoadUnconditionally calls isDereferenceableAndAlignedPointer to check whether speculative execution is possible.
As a side effect optimizations which use isSafeToLoadUnconditionally will benefit from dereferenceable attribute. Corresponding test cases added.