From 77a6b358b51f363d0f1626579720e654ca5aae9a Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Sat, 2 Nov 2019 14:47:45 -0500 Subject: [PATCH] [Attributor][NFCI] Do not track unnecessary dependences If we do not look at assumed information there is no need to track dependences. --- llvm/lib/Transforms/IPO/Attributor.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp index 08c682dfcd6d..b7471a32faf4 100644 --- a/llvm/lib/Transforms/IPO/Attributor.cpp +++ b/llvm/lib/Transforms/IPO/Attributor.cpp @@ -1685,7 +1685,10 @@ static int64_t getKnownNonNullAndDerefBytesForUse( unsigned ArgNo = ICS.getArgumentNo(U); IRPosition IRP = IRPosition::callsite_argument(ICS, ArgNo); - auto &DerefAA = A.getAAFor(QueryingAA, IRP); + // As long as we only use known information there is no need to track + // dependences here. + auto &DerefAA = A.getAAFor(QueryingAA, IRP, + /* TrackDependence */ false); IsNonNull |= DerefAA.isKnownNonNull(); return DerefAA.getKnownDereferenceableBytes(); } @@ -1718,8 +1721,10 @@ static int64_t getKnownNonNullAndDerefBytesForUse( GetPointerBaseWithConstantOffset(UseV, Offset, DL, /*AllowNonInbounds*/ false)) { if (Base == &AssociatedValue) { - auto &DerefAA = - A.getAAFor(QueryingAA, IRPosition::value(*Base)); + // As long as we only use known information there is no need to track + // dependences here. + auto &DerefAA = A.getAAFor( + QueryingAA, IRPosition::value(*Base), /* TrackDependence */ false); IsNonNull |= (!NullPointerIsDefined && DerefAA.isKnownNonNull()); IsNonNull |= (!NullPointerIsDefined && (Offset != 0)); int64_t DerefBytes = DerefAA.getKnownDereferenceableBytes();