@@ -767,7 +767,7 @@ struct SCEVDivision : public SCEVVisitor<Derived, void> {
767
767
const SCEV **Remainder) {
768
768
assert (Numerator && Denominator && " Uninitialized SCEV" );
769
769
770
- SCEVDivision< Derived> D (SE, Numerator, Denominator);
770
+ Derived D (SE, Numerator, Denominator);
771
771
772
772
// Check for the trivial case here to avoid having to check for it in the
773
773
// rest of the code.
@@ -808,17 +808,6 @@ struct SCEVDivision : public SCEVVisitor<Derived, void> {
808
808
*Remainder = D.Remainder ;
809
809
}
810
810
811
- SCEVDivision (ScalarEvolution &S, const SCEV *Numerator, const SCEV *Denominator)
812
- : SE(S), Denominator(Denominator) {
813
- Zero = SE.getConstant (Denominator->getType (), 0 );
814
- One = SE.getConstant (Denominator->getType (), 1 );
815
-
816
- // By default, we don't know how to divide Expr by Denominator.
817
- // Providing the default here simplifies the rest of the code.
818
- Quotient = Zero;
819
- Remainder = Numerator;
820
- }
821
-
822
811
// Except in the trivial case described above, we do not know how to divide
823
812
// Expr by Denominator for the following functions with empty implementation.
824
813
void visitTruncateExpr (const SCEVTruncateExpr *Numerator) {}
@@ -953,6 +942,18 @@ struct SCEVDivision : public SCEVVisitor<Derived, void> {
953
942
}
954
943
955
944
private:
945
+ SCEVDivision (ScalarEvolution &S, const SCEV *Numerator,
946
+ const SCEV *Denominator)
947
+ : SE(S), Denominator(Denominator) {
948
+ Zero = SE.getConstant (Denominator->getType (), 0 );
949
+ One = SE.getConstant (Denominator->getType (), 1 );
950
+
951
+ // By default, we don't know how to divide Expr by Denominator.
952
+ // Providing the default here simplifies the rest of the code.
953
+ Quotient = Zero;
954
+ Remainder = Numerator;
955
+ }
956
+
956
957
ScalarEvolution &SE;
957
958
const SCEV *Denominator, *Quotient, *Remainder, *Zero, *One;
958
959
@@ -961,6 +962,10 @@ struct SCEVDivision : public SCEVVisitor<Derived, void> {
961
962
};
962
963
963
964
struct SCEVSDivision : public SCEVDivision <SCEVSDivision> {
965
+ SCEVSDivision (ScalarEvolution &S, const SCEV *Numerator,
966
+ const SCEV *Denominator)
967
+ : SCEVDivision(S, Numerator, Denominator) {}
968
+
964
969
void visitConstant (const SCEVConstant *Numerator) {
965
970
if (const SCEVConstant *D = dyn_cast<SCEVConstant>(Denominator)) {
966
971
Quotient = SE.getConstant (sdiv (Numerator, D));
@@ -971,6 +976,10 @@ struct SCEVSDivision : public SCEVDivision<SCEVSDivision> {
971
976
};
972
977
973
978
struct SCEVUDivision : public SCEVDivision <SCEVUDivision> {
979
+ SCEVUDivision (ScalarEvolution &S, const SCEV *Numerator,
980
+ const SCEV *Denominator)
981
+ : SCEVDivision(S, Numerator, Denominator) {}
982
+
974
983
void visitConstant (const SCEVConstant *Numerator) {
975
984
if (const SCEVConstant *D = dyn_cast<SCEVConstant>(Denominator)) {
976
985
Quotient = SE.getConstant (udiv (Numerator, D));
0 commit comments