From 5642a42442f669208a88e8f9439904e1150c4688 Mon Sep 17 00:00:00 2001 From: Piotr Padlewski Date: Fri, 18 May 2018 23:54:33 +0000 Subject: 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 --- llvm/lib/Analysis/Loads.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Analysis/Loads.cpp') 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; } -- cgit v1.2.3