@@ -80,6 +80,11 @@ namespace {
80
80
// / all simplifications to users of an IV.
81
81
void simplifyUsers (PHINode *CurrIV, IVVisitor *V = nullptr );
82
82
83
+ void pushIVUsers (Instruction *Def,
84
+ SmallPtrSet<Instruction *, 16 > &Simplified,
85
+ SmallVectorImpl<std::pair<Instruction *, Instruction *>>
86
+ &SimpleIVUsers);
87
+
83
88
Value *foldIVUser (Instruction *UseInst, Instruction *IVOperand);
84
89
85
90
bool eliminateIdentitySCEV (Instruction *UseInst, Instruction *IVOperand);
@@ -839,11 +844,9 @@ bool SimplifyIndvar::strengthenRightShift(BinaryOperator *BO,
839
844
}
840
845
841
846
// / Add all uses of Def to the current IV's worklist.
842
- static void pushIVUsers (
843
- Instruction *Def, Loop *L,
844
- SmallPtrSet<Instruction*,16 > &Simplified,
845
- SmallVectorImpl< std::pair<Instruction*,Instruction*> > &SimpleIVUsers) {
846
-
847
+ void SimplifyIndvar::pushIVUsers (
848
+ Instruction *Def, SmallPtrSet<Instruction *, 16 > &Simplified,
849
+ SmallVectorImpl<std::pair<Instruction *, Instruction *>> &SimpleIVUsers) {
847
850
for (User *U : Def->users ()) {
848
851
Instruction *UI = cast<Instruction>(U);
849
852
@@ -913,7 +916,7 @@ void SimplifyIndvar::simplifyUsers(PHINode *CurrIV, IVVisitor *V) {
913
916
// Push users of the current LoopPhi. In rare cases, pushIVUsers may be
914
917
// called multiple times for the same LoopPhi. This is the proper thing to
915
918
// do for loop header phis that use each other.
916
- pushIVUsers (CurrIV, L, Simplified, SimpleIVUsers);
919
+ pushIVUsers (CurrIV, Simplified, SimpleIVUsers);
917
920
918
921
while (!SimpleIVUsers.empty ()) {
919
922
std::pair<Instruction*, Instruction*> UseOper =
@@ -960,22 +963,22 @@ void SimplifyIndvar::simplifyUsers(PHINode *CurrIV, IVVisitor *V) {
960
963
continue ;
961
964
962
965
if (eliminateIVUser (UseInst, IVOperand)) {
963
- pushIVUsers (IVOperand, L, Simplified, SimpleIVUsers);
966
+ pushIVUsers (IVOperand, Simplified, SimpleIVUsers);
964
967
continue ;
965
968
}
966
969
967
970
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(UseInst)) {
968
971
if (strengthenBinaryOp (BO, IVOperand)) {
969
972
// re-queue uses of the now modified binary operator and fall
970
973
// through to the checks that remain.
971
- pushIVUsers (IVOperand, L, Simplified, SimpleIVUsers);
974
+ pushIVUsers (IVOperand, Simplified, SimpleIVUsers);
972
975
}
973
976
}
974
977
975
978
// Try to use integer induction for FPToSI of float induction directly.
976
979
if (replaceFloatIVWithIntegerIV (UseInst)) {
977
980
// Re-queue the potentially new direct uses of IVOperand.
978
- pushIVUsers (IVOperand, L, Simplified, SimpleIVUsers);
981
+ pushIVUsers (IVOperand, Simplified, SimpleIVUsers);
979
982
continue ;
980
983
}
981
984
@@ -985,7 +988,7 @@ void SimplifyIndvar::simplifyUsers(PHINode *CurrIV, IVVisitor *V) {
985
988
continue ;
986
989
}
987
990
if (isSimpleIVUser (UseInst, L, SE)) {
988
- pushIVUsers (UseInst, L, Simplified, SimpleIVUsers);
991
+ pushIVUsers (UseInst, Simplified, SimpleIVUsers);
989
992
}
990
993
}
991
994
}
0 commit comments