Skip to content
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

Move CVP before instcombine in the pass pipeline #48110

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Keno
Copy link
Member

@Keno Keno commented Jan 4, 2023

I was investigating why LLVM was unable to remove the boundscheck that was causing the test failure in #48066 and it turned out that the check was removable by instcombine, but only if cvp ran first. However, we ran the passes in the opposite order and then loop-rotated the condition away before instcombine ran again. I think it makes sense to run cvp before instcombine to make sure that instcombine can make use of the overflow flags inferred by cvp. For the particular case in #48066, we also need https://reviews.llvm.org/D140933 (and we may need it in general, since we like to emit our conditionals as negations), but overall this seems like a better place for cvp in our pass pipeline.

I was investigating why LLVM was unable to remove the boundscheck
that was causing the test failure in #48066
and it turned out that the check was removable by instcombine, but
only if cvp ran first. However, we ran the passes in the opposite
order and then loop-rotated the condition away before instcombine
ran again. I think it makes sense to run cvp before instcombine to
make sure that instcombine can make use of the overflow flags inferred
by cvp. For the particular case in #48066, we also need
https://reviews.llvm.org/D140933 (and we may need it in general, since
we like to emit our conditionals as negations), but overall
this seems like a better place for cvp in our pass pipeline.
@Keno
Copy link
Member Author

Keno commented Jan 4, 2023

Looks like we'll need to merge https://reviews.llvm.org/D140933 first before we can turn this on.

@pchintalapudi
Copy link
Member

Seems like the indvars pipeline is rather unhappy with this change.

Also, we should keep the newpm pipeline in src/pipeline.cpp in sync with any changes to the legacy pass pipeline.

@Keno
Copy link
Member Author

Keno commented Jan 4, 2023

Yes, we'll need to get in the upstream change for this change to be effective, so that CVP can recognize our negation idiom.

@Keno
Copy link
Member Author

Keno commented Jan 5, 2023

@vchuravy could you queue that LLVM revision for whenever you're planning the next LLVM rebuild? I think it's pretty much good to go upstream just waiting for review.

@vchuravy vchuravy self-assigned this Jan 5, 2023
@vchuravy
Copy link
Member

vchuravy commented Jan 5, 2023

Important for 1.9? Or do we have a bit of time?

@Keno
Copy link
Member Author

Keno commented Jan 5, 2023

I don't think it'll be backported to 1.9, but I do hope to merge #48066 soon and without this some packages will start seeing extra allocations. Not a big issue, but certainly we should get to it before we start seriously pkgevaling 1.10 against 1.9.

@Keno
Copy link
Member Author

Keno commented Jan 5, 2023

Upstream merged as llvm/llvm-project@1436a92

@vtjnash vtjnash requested review from vchuravy and removed request for vchuravy and pchintalapudi August 31, 2023 01:01
@gbaraldi
Copy link
Member

Btw, the aotcompile pipeline is no longer used. For this to have an effect we need to do it in pipeline.cpp

@gbaraldi
Copy link
Member

We have started the LLVM 16 build but as always it's an annoying build

@oscardssmith
Copy link
Member

should we revive this now that we have llvm16?

@vchuravy
Copy link
Member

vchuravy commented Nov 2, 2023

should we revive this now that we have llvm16?

Not yet #51720 is not finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants