[llvm] 327307d - [SCEV] Assert that GEP source element type is sized (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 27 01:51:17 PDT 2022


Author: Nikita Popov
Date: 2022-06-27T10:51:09+02:00
New Revision: 327307d9d4da0045f762f75343fe66b0f10ecc63

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

LOG: [SCEV] Assert that GEP source element type is sized (NFC)

This is checked by the IR verifier, so replace the condition with
an assert.

Added: 
    

Modified: 
    llvm/lib/Analysis/ScalarEvolution.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 13afd709cef4..975a5035059e 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -6161,9 +6161,8 @@ const SCEV *ScalarEvolution::createNodeForSelectOrPHI(Value *V, Value *Cond,
 /// Expand GEP instructions into add and multiply operations. This allows them
 /// to be analyzed by regular SCEV code.
 const SCEV *ScalarEvolution::createNodeForGEP(GEPOperator *GEP) {
-  // Don't attempt to analyze GEPs over unsized objects.
-  if (!GEP->getSourceElementType()->isSized())
-    return getUnknown(GEP);
+  assert(GEP->getSourceElementType()->isSized() &&
+         "GEP source element type must be sized");
 
   SmallVector<const SCEV *, 4> IndexExprs;
   for (Value *Index : GEP->indices())


        


More information about the llvm-commits mailing list