[llvm] 65c053d - [SCEVExpander] Drop ExpandTy argument from expandIVInc() (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 07:22:22 PDT 2023


Author: Nikita Popov
Date: 2023-09-21T16:20:41+02:00
New Revision: 65c053d67a7d81d77120f4de0a3fa89b8fc85bc1

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

LOG: [SCEVExpander] Drop ExpandTy argument from expandIVInc() (NFC)

Check the type of the phi node instead (as the comment already
indicates).

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h b/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
index 0d3c37ba2a5383f..ead8b02ed1e2d22 100644
--- a/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
+++ b/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
@@ -483,7 +483,7 @@ class SCEVExpander : public SCEVVisitor<SCEVExpander, Value *> {
   PHINode *getAddRecExprPHILiterally(const SCEVAddRecExpr *Normalized,
                                      const Loop *L, Type *ExpandTy, Type *IntTy,
                                      Type *&TruncTy, bool &InvertStep);
-  Value *expandIVInc(PHINode *PN, Value *StepV, const Loop *L, Type *ExpandTy,
+  Value *expandIVInc(PHINode *PN, Value *StepV, const Loop *L,
                      bool useSubtract);
 
   void fixupInsertPoints(Instruction *I);

diff  --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
index d5e98e42b4e3443..f939160df7a86c7 100644
--- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
@@ -795,10 +795,10 @@ bool SCEVExpander::isExpandedAddRecExprPHI(PHINode *PN, Instruction *IncV,
 /// Typically this is the LatchBlock terminator or IVIncInsertPos, but we may
 /// need to materialize IV increments elsewhere to handle 
diff icult situations.
 Value *SCEVExpander::expandIVInc(PHINode *PN, Value *StepV, const Loop *L,
-                                 Type *ExpandTy, bool useSubtract) {
+                                 bool useSubtract) {
   Value *IncV;
   // If the PHI is a pointer, use a GEP, otherwise use an add or sub.
-  if (ExpandTy->isPointerTy()) {
+  if (PN->getType()->isPointerTy()) {
     IncV = expandAddToGEP(SE.getSCEV(StepV), PN);
   } else {
     IncV = useSubtract ?
@@ -1037,7 +1037,7 @@ SCEVExpander::getAddRecExprPHILiterally(const SCEVAddRecExpr *Normalized,
     Instruction *InsertPos = L == IVIncInsertLoop ?
       IVIncInsertPos : Pred->getTerminator();
     Builder.SetInsertPoint(InsertPos);
-    Value *IncV = expandIVInc(PN, StepV, L, ExpandTy, useSubtract);
+    Value *IncV = expandIVInc(PN, StepV, L, useSubtract);
 
     if (isa<OverflowingBinaryOperator>(IncV)) {
       if (IncrementIsNUW)
@@ -1167,7 +1167,7 @@ Value *SCEVExpander::expandAddRecExprLiterally(const SCEVAddRecExpr *S) {
         StepV =
             expandCodeFor(Step, IntTy, L->getHeader()->getFirstInsertionPt());
       }
-      Result = expandIVInc(PN, StepV, L, ExpandTy, useSubtract);
+      Result = expandIVInc(PN, StepV, L, useSubtract);
     }
   }
 


        


More information about the llvm-commits mailing list