[PATCH] D16227: Make context-sensitive isDereferenceable queries in isSafeToLoadUnconditionally
Artur Pilipenko via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 11 05:47:25 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL260520: Make context-sensitive isDereferenceable queries in isSafeToLoadUnconditionally (authored by apilipenko).
Changed prior to commit:
http://reviews.llvm.org/D16227?vs=45001&id=47632#toc
Repository:
rL LLVM
http://reviews.llvm.org/D16227
Files:
llvm/trunk/include/llvm/Analysis/Loads.h
llvm/trunk/lib/Analysis/Loads.cpp
Index: llvm/trunk/lib/Analysis/Loads.cpp
===================================================================
--- llvm/trunk/lib/Analysis/Loads.cpp
+++ llvm/trunk/lib/Analysis/Loads.cpp
@@ -56,22 +56,28 @@
/// \brief Check if executing a load of this pointer value cannot trap.
///
+/// If DT is specified this method performs context-sensitive analysis.
+///
/// If it is not obviously safe to load from the specified pointer, we do
/// a quick local scan of the basic block containing \c ScanFrom, to determine
/// if the address is already accessed.
///
/// 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 DT is not specified we can't make context-sensitive query
+ const Instruction* CtxI = DT ? ScanFrom : nullptr;
+ if (isDereferenceableAndAlignedPointer(V, Align, DL, CtxI, DT, TLI))
return true;
int64_t ByteOffset = 0;
Index: llvm/trunk/include/llvm/Analysis/Loads.h
===================================================================
--- llvm/trunk/include/llvm/Analysis/Loads.h
+++ llvm/trunk/include/llvm/Analysis/Loads.h
@@ -24,11 +24,17 @@
class MDNode;
/// isSafeToLoadUnconditionally - Return true if we know that executing a load
-/// from this value cannot trap. If it is not obviously safe to load from the
-/// specified pointer, we do a quick local scan of the basic block containing
-/// ScanFrom, to determine if the address is already accessed.
+/// from this value cannot trap.
+///
+/// If DT is specified this method performs context-sensitive analysis.
+///
+/// If it is not obviously safe to load from the 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.47632.patch
Type: text/x-patch
Size: 2883 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160211/a139301f/attachment.bin>
More information about the llvm-commits
mailing list