This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Use isKnownNonZero() for SCEV verification
Needs ReviewPublic

Authored by nikic on Jun 9 2023, 3:19 AM.

Details

Summary

Report all cases where we can prove that the expressions are not the same, rather than just the cases where we know the exact constant delta.

In part this is intended to clarify the difference with verify-scev-strict mode, which reports cases where we cannot prove that the expressions are the same.

Diff Detail

Event Timeline

nikic created this revision.Jun 9 2023, 3:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2023, 3:19 AM
nikic requested review of this revision.Jun 9 2023, 3:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2023, 3:19 AM
goldstein.w.n added inline comments.
llvm/lib/Analysis/ScalarEvolution.cpp
14055

I don't quite understand the new comment for "In VerifySCEVStrict mode...". Before it was clear; constants only. I don't see how !Delta->isZero() implies we are unable prove the expressions are the same but isKnownNonZero(Delta) doesn't.

nikic added inline comments.Jun 9 2023, 1:25 PM
llvm/lib/Analysis/ScalarEvolution.cpp
14055

The answer to "Is Delta zero?" can be "yes", "no" and "unknown". By default only "no" answers are verification failures. In VerifySCEVStrict mode "unknown" answers are verification failures as well (which is why they are almost certainly false positives).