[llvm] 1a18fe6 - Analysis: Remove redundant assertion

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


Author: Matt Arsenault
Date: 2022-09-20T09:39:45-04:00
New Revision: 1a18fe65d321cb47d43682bd515afb140caccd47

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

LOG: Analysis: Remove redundant assertion

This assert guards the same assertion inside getTypeStoreSizeInBits

Added: 
    

Modified: 
    llvm/lib/Analysis/Loads.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp
index a21649a274ee..9eff2b161185 100644
--- a/llvm/lib/Analysis/Loads.cpp
+++ b/llvm/lib/Analysis/Loads.cpp
@@ -82,9 +82,7 @@ static bool isDereferenceableAndAlignedPointer(
       // 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.
-      Type *Ty = V->getType();
-      assert(Ty->isSized() && "must be sized");
-      APInt Offset(DL.getTypeStoreSizeInBits(Ty), 0);
+      APInt Offset(DL.getTypeStoreSizeInBits(V->getType()), 0);
       return isAligned(V, Offset, Alignment, DL);
     }
 
@@ -174,9 +172,7 @@ static bool isDereferenceableAndAlignedPointer(
         // 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.
-        Type *Ty = V->getType();
-        assert(Ty->isSized() && "must be sized");
-        APInt Offset(DL.getTypeStoreSizeInBits(Ty), 0);
+        APInt Offset(DL.getTypeStoreSizeInBits(V->getType()), 0);
         return isAligned(V, Offset, Alignment, DL);
       }
     }


        


More information about the llvm-commits mailing list