Skip to content

Add visitGEPOfAlloc to restore the visitGEPOfBitcast part of the behavior of non-opaque pointers. #65764

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

Closed
wants to merge 2 commits into from

Conversation

dianqk
Copy link
Member

@dianqk dianqk commented Sep 8, 2023

Closes #65763.

@dianqk dianqk requested a review from a team as a code owner September 8, 2023 14:32
Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We definitely shouldn't do this. From the issue, it's not clear where the problem actually is (given lack of reproducer), but I expect that this needs to be solved by teaching some transform to use offset-based reasoning for GEPs (or alternatively, by canonicalizing to i8 GEPs).

@dianqk
Copy link
Member Author

dianqk commented Sep 9, 2023

We definitely shouldn't do this. From the issue, it's not clear where the problem actually is (given lack of reproducer), but I expect that this needs to be solved by teaching some transform to use offset-based reasoning for GEPs (or alternatively, by canonicalizing to i8 GEPs).

Thanks for the reply. I feel like I understand the issue a little better.
I found out earlier that SROA was not canonicalizing all the GEPs to i8 GEPs due to the escaped scene.
Since non-opaque pointers are OK, I incorrectly guessed it was a regression issue. So I didn't look at that part in depth.

I tried a lot of reproducers using llvm-reduce. An LLVM any-version reproducer may not exist.
I believe it was the various transformations of GEP that led to the constant inference that was lucky. That should be the essence of the problem.
Here just lucky in the case of non-opaque pointers.
I can execute inline before any pass. This is a reproducer of LLVM 16 not being able to optimize successfully in either mode.

Do you think bringing ahead GVN to LoopFullUnroll is the right choice? This should provide more optimization opportunities for LoopFullUnroll.

@dianqk
Copy link
Member Author

dianqk commented Sep 9, 2023

Preparing an early-cse PR.

@dianqk dianqk closed this Sep 9, 2023
@dianqk dianqk deleted the restore-gep-original-struct branch September 9, 2023 07:38
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.

LoopFullUnrollPass failed due to constant inference in opaque pointer mode.
2 participants