[llvm] 0886fd5 - [SCEVExpander] Remove unnecessary mul/udiv check (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 29 11:48:02 PDT 2021


Author: Nikita Popov
Date: 2021-08-29T20:47:00+02:00
New Revision: 0886fd5b3a374525c382145deee7049ec1d0fe91

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

LOG: [SCEVExpander] Remove unnecessary mul/udiv check (NFC)

Pointer-typed SCEV expressions can no longer be mul or udiv, so
we do not need to specially handle them here.

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 e0205c1fd582..5d3d98a25b66 100644
--- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
@@ -1581,14 +1581,9 @@ Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) {
     ExposePointerBase(Base, ExposedRest, SE);
     // If we found a pointer, expand the AddRec with a GEP.
     if (PointerType *PTy = dyn_cast<PointerType>(Base->getType())) {
-      // Make sure the Base isn't something exotic, such as a multiplied
-      // or divided pointer value. In those cases, the result type isn't
-      // actually a pointer type.
-      if (!isa<SCEVMulExpr>(Base) && !isa<SCEVUDivExpr>(Base)) {
-        Value *StartV = expand(Base);
-        assert(StartV->getType() == PTy && "Pointer type mismatch for GEP!");
-        return expandAddToGEP(ExposedRest, PTy, Ty, StartV);
-      }
+      Value *StartV = expand(Base);
+      assert(StartV->getType() == PTy && "Pointer type mismatch for GEP!");
+      return expandAddToGEP(ExposedRest, PTy, Ty, StartV);
     }
 
     // Just do a normal add. Pre-expand the operands to suppress folding.


        


More information about the llvm-commits mailing list