@@ -290,7 +290,7 @@ class StraightLineStrengthReduce {
290290 }
291291
292292 // Evaluate if the given delta is profitable to rewrite this candidate.
293- bool isProfitableRewrite (const Value * Delta, const DKind DeltaKind) const {
293+ bool isProfitableRewrite (const Value & Delta, const DKind DeltaKind) const {
294294 // This function cannot accurately evaluate the profit of whole expression
295295 // with context. A candidate (B + I * S) cannot express whether this
296296 // instruction needs to compute on its own (I * S), which may be shared
@@ -308,22 +308,22 @@ class StraightLineStrengthReduce {
308308
309309 // Evaluate the rewrite efficiency of this candidate with its Basis
310310 EfficiencyLevel getRewriteEfficiency () const {
311- return Basis ? getRewriteEfficiency (Delta, DeltaKind) : Unknown;
311+ return Basis ? getRewriteEfficiency (* Delta, DeltaKind) : Unknown;
312312 }
313313
314314 // Evaluate the rewrite efficiency of this candidate with a given delta
315- EfficiencyLevel getRewriteEfficiency (const Value * Delta,
315+ EfficiencyLevel getRewriteEfficiency (const Value & Delta,
316316 const DKind DeltaKind) const {
317317 switch (DeltaKind) {
318318 case BaseDelta: // [X + Delta]
319319 return getComputationEfficiency (
320320 CandidateKind,
321- ConstantInt::get (cast<IntegerType>(Delta-> getType ()), 1 ), Delta);
321+ ConstantInt::get (cast<IntegerType>(Delta. getType ()), 1 ), & Delta);
322322 case StrideDelta: // [X + Index * Delta]
323- return getComputationEfficiency (CandidateKind, Index, Delta);
323+ return getComputationEfficiency (CandidateKind, Index, & Delta);
324324 case IndexDelta: // [X + Delta * Stride]
325- return getComputationEfficiency (CandidateKind, cast<ConstantInt>(Delta),
326- Stride);
325+ return getComputationEfficiency (CandidateKind,
326+ cast<ConstantInt>(&Delta), Stride);
327327 default :
328328 return Unknown;
329329 }
@@ -696,7 +696,7 @@ bool StraightLineStrengthReduce::candidatePredicate(Candidate *Basis,
696696 // So, we need to check if the rewrite form's computation efficiency
697697 // is better than the original form.
698698 if (K == Candidate::IndexDelta &&
699- !C.isProfitableRewrite (Delta, Candidate::IndexDelta))
699+ !C.isProfitableRewrite (* Delta, Candidate::IndexDelta))
700700 return false ;
701701
702702 // If there is a Delta that we can reuse Basis to rewrite C,
0 commit comments