[llvm] r306193 - Make visible isDereferenceableAndAlignedPointer(..., const APInt &Size, ...)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 23 18:35:13 PDT 2017
Author: vitalybuka
Date: Fri Jun 23 20:35:13 2017
New Revision: 306193
URL: http://llvm.org/viewvc/llvm-project?rev=306193&view=rev
Log:
Make visible isDereferenceableAndAlignedPointer(..., const APInt &Size, ...)
Summary: Used by D34311 and D34467
Reviewers: hfinkel, efriedma
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D34585
Modified:
llvm/trunk/include/llvm/Analysis/Loads.h
llvm/trunk/lib/Analysis/Loads.cpp
Modified: llvm/trunk/include/llvm/Analysis/Loads.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Loads.h?rev=306193&r1=306192&r2=306193&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/Loads.h (original)
+++ llvm/trunk/include/llvm/Analysis/Loads.h Fri Jun 23 20:35:13 2017
@@ -39,6 +39,15 @@ bool isDereferenceableAndAlignedPointer(
const Instruction *CtxI = nullptr,
const DominatorTree *DT = nullptr);
+/// Returns true if V is always dereferenceable for Size byte with alignment
+/// greater or equal than requested. If the context instruction is specified
+/// performs context-sensitive analysis and returns true if the pointer is
+/// dereferenceable at the specified instruction.
+bool isDereferenceableAndAlignedPointer(const Value *V, unsigned Align,
+ const APInt &Size, const DataLayout &DL,
+ const Instruction *CtxI = nullptr,
+ const DominatorTree *DT = nullptr);
+
/// Return true if we know that executing a load from this value cannot trap.
///
/// If DT and ScanFrom are specified this method performs context-sensitive
Modified: llvm/trunk/lib/Analysis/Loads.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/Loads.cpp?rev=306193&r1=306192&r2=306193&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/Loads.cpp (original)
+++ llvm/trunk/lib/Analysis/Loads.cpp Fri Jun 23 20:35:13 2017
@@ -117,6 +117,16 @@ static bool isDereferenceableAndAlignedP
}
bool llvm::isDereferenceableAndAlignedPointer(const Value *V, unsigned Align,
+ const APInt &Size,
+ const DataLayout &DL,
+ const Instruction *CtxI,
+ const DominatorTree *DT) {
+ SmallPtrSet<const Value *, 32> Visited;
+ return ::isDereferenceableAndAlignedPointer(V, Align, Size, DL, CtxI, DT,
+ Visited);
+}
+
+bool llvm::isDereferenceableAndAlignedPointer(const Value *V, unsigned Align,
const DataLayout &DL,
const Instruction *CtxI,
const DominatorTree *DT) {
More information about the llvm-commits
mailing list