[PATCH] D65474: [SCEV] Return zero from computeConstantDifference(X, X)

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 15:02:28 PDT 2019


sanjoy requested changes to this revision.
sanjoy added a comment.
This revision now requires changes to proceed.

> We use computeConstantDifference in some downstream code, and I was surprised to find out that it fails to compute (X - X) difference, unless X is a SCEVAddExpr.

Can you use `getMinusSCEV` instead (which should DTRT)?

This looks like a small change, having many such cases (especially without unit tests) makes it difficult to refactor code confidently.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65474/new/

https://reviews.llvm.org/D65474





More information about the llvm-commits mailing list