-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LSR] Consider post-inc form when creating extends/truncates.
GenerateTruncates at the moment creates extends/truncates for post-inc uses of normalized expressions. For example, if an add rec of the form {1,+,-1} is used outside the loop, the normalized form will use {1,+,-1} instead of {0,+,-1}. When naively sign-extending the normalized expression, it will get extended incorrectly to {1,+,-1} for the wider type, if the backedge-taken count of the loop is 1. To address this, the patch updates GenerateTruncates to check if the LSRUse contains any fixups with PostIncLoops. If that's the case, first de-normalize the expression, then perform the extend/truncate, then normalize again. There may be other places where similar checks are needed and the helper can be generalized for those cases. I'd not be surprised if other subtle mis-compiles are caused by this. Fixes #38847. Fixes #58039. Fixes #62852. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D153004
- Loading branch information
Showing
2 changed files
with
50 additions
and
23 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