summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/Loads.cpp
diff options
context:
space:
mode:
authorPiotr Padlewski <piotr.padlewski@gmail.com>2018-05-18 23:54:33 +0000
committerPiotr Padlewski <piotr.padlewski@gmail.com>2018-05-18 23:54:33 +0000
commit5642a42442f669208a88e8f9439904e1150c4688 (patch)
treed1162fb9c6895f58fd3cd43feea214ca3711bf67 /llvm/lib/Analysis/Loads.cpp
parentce358262eb7ddc3bf4b251c61feb87c561ad5378 (diff)
downloadbcm5719-llvm-5642a42442f669208a88e8f9439904e1150c4688.tar.gz
bcm5719-llvm-5642a42442f669208a88e8f9439904e1150c4688.zip
Propagate nonnull and dereferenceable throught launder
Summary: invariant.group.launder should not stop propagation of nonnull and dereferenceable, because e.g. we would not be able to hoist loads speculatively. Reviewers: rsmith, amharc, kuhar, xbolva00, hfinkel Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D46972 llvm-svn: 332788
Diffstat (limited to 'llvm/lib/Analysis/Loads.cpp')
-rw-r--r--llvm/lib/Analysis/Loads.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp
index 10a71de82e3..fda1395cf3e 100644
--- a/llvm/lib/Analysis/Loads.cpp
+++ b/llvm/lib/Analysis/Loads.cpp
@@ -107,11 +107,14 @@ static bool isDereferenceableAndAlignedPointer(
return isDereferenceableAndAlignedPointer(ASC->getOperand(0), Align, Size,
DL, CtxI, DT, Visited);
- if (auto CS = ImmutableCallSite(V))
+ if (auto CS = ImmutableCallSite(V)) {
if (const Value *RV = CS.getReturnedArgOperand())
return isDereferenceableAndAlignedPointer(RV, Align, Size, DL, CtxI, DT,
Visited);
-
+ if (CS.getIntrinsicID() == Intrinsic::launder_invariant_group)
+ return isDereferenceableAndAlignedPointer(CS->getOperand(0), Align, Size,
+ DL, CtxI, DT, Visited);
+ }
// If we don't know, assume the worst.
return false;
}
OpenPOWER on IntegriCloud