[llvm] [DA] Fix Strong SIV test for symbolic coefficients and deltas (#149977) (PR #157738)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 10 01:37:45 PDT 2025


https://github.com/kasuga-fj commented:

What I was trying to emphasize in that issue is simpler: the method used to compute the absolute value is incorrect. Currently both `AbsDelta` and `AbsCoeff` is computed as follows:

```c
const SCEV  *AbsXXX = SE->isKnownNonNegative(XXX) ? XXX : SE->getNegativeSCEV(XXX);
```

If the sign of `XXX` is unknown, `isKnownNonNegative(XXX)` will return false, resulting in `AbsXXX` being `-XXX`, which can be negative. The correct way to compute the absolute value is using `ScalarEvolution::getAbsExpr`.

https://github.com/llvm/llvm-project/pull/157738


More information about the llvm-commits mailing list