[llvm] bec4e86 - [SCEVExpander] Remove pointer element type access in assertion

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 26 01:36:10 PST 2022


Author: Nikita Popov
Date: 2022-01-26T10:35:57+01:00
New Revision: bec4e865dedfa36fc9c03139268f405e32e9be1d

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

LOG: [SCEVExpander] Remove pointer element type access in assertion

Assert directly on i8 rather than the element type of i8*.

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
index c6044f8fdffd7..1495ea1a40882 100644
--- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
@@ -173,7 +173,7 @@ Value *SCEVExpander::InsertNoopCastOfTo(Value *V, Type *Ty) {
     auto *PtrTy = cast<PointerType>(Ty);
     if (DL.isNonIntegralPointerType(PtrTy)) {
       auto *Int8PtrTy = Builder.getInt8PtrTy(PtrTy->getAddressSpace());
-      assert(DL.getTypeAllocSize(Int8PtrTy->getPointerElementType()) == 1 &&
+      assert(DL.getTypeAllocSize(Builder.getInt8Ty()) == 1 &&
              "alloc size of i8 must by 1 byte for the GEP to be correct");
       auto *GEP = Builder.CreateGEP(
           Builder.getInt8Ty(), Constant::getNullValue(Int8PtrTy), V, "uglygep");


        


More information about the llvm-commits mailing list