-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[LoopInterchange] Redundant isLexicographicallyPositive check #117343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sjoerdmeijer
wants to merge
1
commit into
llvm:main
Choose a base branch
from
sjoerdmeijer:li-lexpos-check
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, there was a reason for
isLexicographicallyPositive(Cur)
to be called before the swap. I did not recall explicitly but it likely has something to do with'S'
or'*'
dependency. We had encountered a number of bugs due to the fact that'S'
and'*'
not very easily dealt with in loop interchange.If you remove the
isLexicographicallyPositive()
call here, likely bugs would appear. I probably do not have enough time digging into it at the moment, but you may refer to this patch (https://reviews.llvm.org/D137461
) and also earlier patches and issues in loop interchange.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for that pointer.
I agree with the following from that phabricator review, that's what I am saying too:
The impression that I get from that discussion and the mishandling of scalar dependencies, is that we are not really sure why we are doing things.
Anyway, I don't have too strong opinions on this, I still don't think it is necessary, but I will focus on #119345 first.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I found this PR by chance. I think
isLexicographicallyPositive
check is necessary before the interchange.I think the following case is a counterexample to this.
Please see also: https://godbolt.org/z/roP9qc7PK
There is a direction vector
[* <]
, which is interpreted as not lexicographically positive before the interchange, but positive after it.If you want to reduce compilation time, I think one way would be to stop all the subsequent processes and exit when we find a direction vector with
*
on its first element. However, with improving the legality check, I believe some of these cases should be interchangeable in the future.