This is an archive of the discontinued LLVM Phabricator instance.

Logically Dead Code
Needs ReviewPublic

Authored by chakshugrover on Aug 13 2015, 9:28 AM.

Details

Reviewers
rsmith
Summary

Removed Logically Dead Code

3373	  const unsigned MaxEditDistance = 1;
3374	  unsigned BestEditDistance = MaxEditDistance + 1;

assigns BestEditDistance=2U

3382	  if (EditDistance > MaxEditDistance)
3383	    return;

As we take false branch after it, so EditDistance is atmost 1U after this check.

3384	  if (EditDistance == BestEditDistance)
3385	    BestMethod.push_back(Method);

As EditDistance is atmost 1U and BestEditDistance is 2U, So this condition can never be true and can be removed

3386	  else if (EditDistance < BestEditDistance) {

And this condition is always true so check can be removed.
So in fact BestEditDistance can essentially be completely removed from the code.

Diff Detail

Event Timeline

chakshugrover retitled this revision from to Logically Dead Code.
chakshugrover updated this object.
chakshugrover added a subscriber: llvm-commits.