[llvm] 3e2ae92 - [SCEV] Remove an unnecessary GEP type check

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 25 03:56:52 PST 2022


Author: Nikita Popov
Date: 2022-01-25T12:56:46+01:00
New Revision: 3e2ae92d3f062f47b7cc8103e9a6c15b815d9018

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

LOG: [SCEV] Remove an unnecessary GEP type check

The code already checked that the addrec step size and type alloc
size are the same. The actual pointer element type is irrelevant
here.

Added: 
    

Modified: 
    llvm/lib/Analysis/ScalarEvolution.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 4f2123b4c5fa..07aac1523b47 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -7596,10 +7596,6 @@ const SCEV *ScalarEvolution::getConstantMaxTripCountFromArray(const Loop *L) {
       auto *ArrSize = dyn_cast<ConstantInt>(AllocateInst->getArraySize());
       if (!Ty || !ArrSize || !ArrSize->isOne())
         continue;
-      // Also make sure step was increased the same with sizeof allocated
-      // element type.
-      if (Ty->getElementType() != GEP->getType()->getPointerElementType())
-        continue;
 
       // FIXME: Since gep indices are silently zext to the indexing type,
       // we will have a narrow gep index which wraps around rather than


        


More information about the llvm-commits mailing list