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

Nikolai Bozhenov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 13:50:14 PDT 2019


n.bozhenov added a comment.

In D65474#1607075 <https://reviews.llvm.org/D65474#1607075>, @lebedev.ri wrote:

> Test?


I agree that it would be nice to have a test for this, but I failed to find a way to test it. I would appreciate it if you could suggest how I could test the result of computeConstantDifference method. Please, keep in mind that the method is private.

Alternatively, we could commit this patch without a dedicated test, as the code is trivial. This piece of code is executed multiple times when running make check (about 400 lit tests). It doesn't change the observed behavior, though.

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.


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