forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SCEV] Consolidate code for proving wrap flags of controlling finite …
…IVs (llvm#101404) The canAssumeNoSelfWrap routine in howManyLessThans was doing two subtly inter-related things. First, it was proving no-self-wrap. This exactly duplicates the existing logic in the caller. Second, it was establishing the precondition for the nw->nsw/nuw inference. Specifically, we need to know that *this* exit must be taken for the inference to be sound. Otherwise, another (possible abnormal) exit could be taken in the iteration where this IV would become poison. This change moves all of that logic into the caller, and caches the resulting nuw/nsw flags in the AddRec. This centralizes the logic in one place, and makes it clear that it all depends on controlling the sole exit. We do loose a couple cases with SCEV predication. Specifically, if SCEV predication was able to convert e.g. zext(addrec) into an addrec(zext) using predication, but didn't record the nuw fact on the new addrec, then the consuming code can no longer fix this up. I don't think this case particularly matters. --------- Co-authored-by: Nikita Popov <github@npopov.com>
- Loading branch information
Showing
3 changed files
with
29 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters