[llvm] 1e1aefb - Analysis: Pass AssumptionCache through isKnownNonZero

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 20 06:43:36 PDT 2022


Author: Matt Arsenault
Date: 2022-09-20T09:25:18-04:00
New Revision: 1e1aefbf70007307b0a4a29400c4cd04ec1857ba

URL: https://github.com/llvm/llvm-project/commit/1e1aefbf70007307b0a4a29400c4cd04ec1857ba
DIFF: https://github.com/llvm/llvm-project/commit/1e1aefbf70007307b0a4a29400c4cd04ec1857ba.diff

LOG: Analysis: Pass AssumptionCache through isKnownNonZero

Pass this through now that isDereferenceableAndAlignedPointer has
access to this.

Added: 
    

Modified: 
    llvm/lib/Analysis/Loads.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp
index f2fa9e06ea84d..a21649a274ee8 100644
--- a/llvm/lib/Analysis/Loads.cpp
+++ b/llvm/lib/Analysis/Loads.cpp
@@ -78,7 +78,7 @@ static bool isDereferenceableAndAlignedPointer(
                                                           CheckForFreed));
   if (KnownDerefBytes.getBoolValue() && KnownDerefBytes.uge(Size) &&
       !CheckForFreed)
-    if (!CheckForNonNull || isKnownNonZero(V, DL, 0, nullptr, CtxI, DT)) {
+    if (!CheckForNonNull || isKnownNonZero(V, DL, 0, AC, CtxI, DT)) {
       // As we recursed through GEPs to get here, we've incrementally checked
       // that each step advanced by a multiple of the alignment. If our base is
       // properly aligned, then the original offset accessed must also be.
@@ -169,7 +169,7 @@ static bool isDereferenceableAndAlignedPointer(
     if (getObjectSize(V, ObjSize, DL, TLI, Opts)) {
       APInt KnownDerefBytes(Size.getBitWidth(), ObjSize);
       if (KnownDerefBytes.getBoolValue() && KnownDerefBytes.uge(Size) &&
-          isKnownNonZero(V, DL, 0, nullptr, CtxI, DT) && !V->canBeFreed()) {
+          isKnownNonZero(V, DL, 0, AC, CtxI, DT) && !V->canBeFreed()) {
         // As we recursed through GEPs to get here, we've incrementally
         // checked that each step advanced by a multiple of the alignment. If
         // our base is properly aligned, then the original offset accessed


        


More information about the llvm-commits mailing list