[PATCH] D10920: Unify isSafeToLoadUnconditionally and isDereferenceablePointer

Artur Pilipenko via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 08:40:39 PDT 2015

apilipenko added inline comments.

Comment at: lib/Analysis/Loads.cpp:72
@@ -69,2 +71,3 @@
+                                       const TargetLibraryInfo *TLI) {
   // Zero alignment means that the load has the ABI alignment for the target
   if (Align == 0)
hfinkel wrote:
> Why can this part not be unified?
> It seems this is the only difference. Why don't we just eliminate this function in favor of isDereferenceableAndAlignedPointer?
isDereferenceableAndAlignedPointer checks properties of the pointer. isSafeToLoadUnconditionally calls isDereferenceableAndAlignedPointer and also checks whether this pointer was dereferenced in current BB. So, isSafeToLoadUnconditionally is more powerful and must be used everywhere to check if the load can be speculated.


More information about the llvm-commits mailing list