[PATCH] D16227: Make context-sensitive isDereferenceable queries in isSafeToLoadUnconditionally

Artur Pilipenko via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 09:03:44 PST 2016


apilipenko updated this revision to Diff 45001.

http://reviews.llvm.org/D16227

Files:
  include/llvm/Analysis/Loads.h
  lib/Analysis/Loads.cpp

Index: lib/Analysis/Loads.cpp
===================================================================
--- lib/Analysis/Loads.cpp
+++ lib/Analysis/Loads.cpp
@@ -63,15 +63,17 @@
 /// This uses the pointee type to determine how many bytes need to be safe to
 /// load from the pointer.
 bool llvm::isSafeToLoadUnconditionally(Value *V, unsigned Align,
-                                       Instruction *ScanFrom) {
+                                       Instruction *ScanFrom,
+                                       const DominatorTree *DT,
+                                       const TargetLibraryInfo *TLI) {
   const DataLayout &DL = ScanFrom->getModule()->getDataLayout();
 
   // Zero alignment means that the load has the ABI alignment for the target
   if (Align == 0)
     Align = DL.getABITypeAlignment(V->getType()->getPointerElementType());
   assert(isPowerOf2_32(Align));
 
-  if (isDereferenceableAndAlignedPointer(V, Align, DL))
+  if (isDereferenceableAndAlignedPointer(V, Align, DL, ScanFrom, DT, TLI))
     return true;
 
   int64_t ByteOffset = 0;
Index: include/llvm/Analysis/Loads.h
===================================================================
--- include/llvm/Analysis/Loads.h
+++ include/llvm/Analysis/Loads.h
@@ -28,7 +28,9 @@
 /// specified pointer, we do a quick local scan of the basic block containing
 /// ScanFrom, to determine if the address is already accessed.
 bool isSafeToLoadUnconditionally(Value *V, unsigned Align,
-                                 Instruction *ScanFrom);
+                                 Instruction *ScanFrom,
+                                 const DominatorTree *DT = nullptr,
+                                 const TargetLibraryInfo *TLI = nullptr);
 
 /// DefMaxInstsToScan - the default number of maximum instructions
 /// to scan in the block, used by FindAvailableLoadedValue().


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16227.45001.patch
Type: text/x-patch
Size: 1852 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160115/5957f11a/attachment.bin>


More information about the llvm-commits mailing list