summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorArtur Pilipenko <apilipenko@azulsystems.com>2016-04-27 11:00:48 +0000
committerArtur Pilipenko <apilipenko@azulsystems.com>2016-04-27 11:00:48 +0000
commit9bb6beabf4f4b7815b0e172530fb190a2a04c5ad (patch)
tree49dfa05b0079639b4d643f20c8e63606cb3ef8d6 /llvm/lib/Analysis
parenta4d7d783d04f15b65c749daa33baa3d94b1e5904 (diff)
downloadbcm5719-llvm-9bb6beabf4f4b7815b0e172530fb190a2a04c5ad.tar.gz
bcm5719-llvm-9bb6beabf4f4b7815b0e172530fb190a2a04c5ad.zip
isSafeToLoadUnconditionally support queries without a context
This is required to use this function from isSafeToSpeculativelyExecute Reviewed By: hfinkel Differential Revision: http://reviews.llvm.org/D16231 llvm-svn: 267692
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/Loads.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp
index c5d23136733..445e577f805 100644
--- a/llvm/lib/Analysis/Loads.cpp
+++ b/llvm/lib/Analysis/Loads.cpp
@@ -260,7 +260,8 @@ static bool AreEquivalentAddressValues(const Value *A, const Value *B) {
/// \brief Check if executing a load of this pointer value cannot trap.
///
-/// If DT is specified this method performs context-sensitive analysis.
+/// If DT and ScanFrom are specified this method performs context-sensitive
+/// analysis and returns true if it is safe to load immediately before ScanFrom.
///
/// 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
@@ -269,11 +270,10 @@ static bool AreEquivalentAddressValues(const Value *A, const Value *B) {
/// 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,
+ const DataLayout &DL,
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());
@@ -326,6 +326,9 @@ bool llvm::isSafeToLoadUnconditionally(Value *V, unsigned Align,
}
}
+ if (!ScanFrom)
+ return false;
+
// Otherwise, be a little bit aggressive by scanning the local block where we
// want to check to see if the pointer is already being loaded or stored
// from/to. If so, the previous load or store would have already trapped,
OpenPOWER on IntegriCloud