Page MenuHomePhabricator

[SCEV] Infer addrec nowrap flags while calculating ranges (WIP)
Needs ReviewPublic

Authored by nikic on Oct 28 2020, 1:29 PM.

Details

Reviewers
bollu
Summary

We can already calculate nowrap flags based on range information in proveNoWrapViaConstantRanges(). However, because this happens separately from the range calculation, we lose some information and produce less precise results. Moving the nowrap flag calculation into getRangeRef() allows us to retain full precision.

This is semantically ugly in that quality of nowrap flags depends on whether the range was calculated or not. Of course, this is nothing new, e.g. the code this replaces was adding nowrap flags only when an addrec was zexted/sexted.

Diff Detail

Event Timeline

nikic created this revision.Oct 28 2020, 1:29 PM
Herald added a project: Restricted Project. · View Herald Transcript
nikic requested review of this revision.Oct 28 2020, 1:29 PM
nikic updated this revision to Diff 301456.Oct 28 2020, 3:44 PM
nikic edited the summary of this revision. (Show Details)

Rebase. It looks like this patch had some functional overlap with https://github.com/llvm/llvm-project/commit/160a453138429f5e389de877fd02db2bb7dc6765, in that it was able to prove 4 out of 5 conditions without the additional logic added there.

@mkazantsev Before I deal with the remaining tests, any thoughts on the general idea here?