This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Support sub in and negative constants willNotOverflow
ClosedPublic

Authored by mkazantsev on Apr 18 2023, 1:51 AM.

Details

Summary

This lifts two TODOs from this function, allowing us to prove
no-overflow whether it happens through max int (up) or through
min int (down) for both and and sub.

Diff Detail

Event Timeline

mkazantsev created this revision.Apr 18 2023, 1:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 18 2023, 1:51 AM
mkazantsev requested review of this revision.Apr 18 2023, 1:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 18 2023, 1:51 AM
mkazantsev planned changes to this revision.Apr 18 2023, 8:41 AM

Internal testing found a bug, investigating.

Ah ok, it is only legal for signed.

mkazantsev retitled this revision from [SCEV] Support sub in willNotOverflow to [SCEV] Support sub in and negative constants willNotOverflow.
mkazantsev edited the summary of this revision. (Show Details)

Bug fixed, logic expanded.

This revision is now accepted and ready to land.Apr 25 2023, 12:16 AM
dmakogon added inline comments.Apr 25 2023, 12:54 AM
llvm/lib/Analysis/ScalarEvolution.cpp
2372

You don't need this else after return

mkazantsev added inline comments.Apr 25 2023, 2:30 AM
llvm/lib/Analysis/ScalarEvolution.cpp
2372

Indeed.

mkazantsev added inline comments.Apr 25 2023, 2:40 AM
llvm/lib/Analysis/ScalarEvolution.cpp
2372

I just want to keep it that way because it is so perfectly aligned one under one.

This revision was landed with ongoing or failed builds.Apr 25 2023, 3:08 AM
This revision was automatically updated to reflect the committed changes.