Skip to content

[CodeGen] Fix PreISelLowering not reporting changes #102184

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

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

aengelke
Copy link
Contributor

@aengelke aengelke commented Aug 6, 2024

expandVectorPredication may change code, even if the intrinsic itself remains in the code. Report changes whenever such an intrinsic is encountered, because code could have been changed.

Another follow-up fix for #101652 to fix expensive-checks-only failure.

expandVectorPredication may change code, even if the intrinsic itself
remains in the code. Report changes whenever such an intrinsic is
encountered, because code could have been changed.
Copy link
Collaborator

@rofirrim rofirrim left a comment

Choose a reason for hiding this comment

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

Right, IIRC we may only change the mask/evl but leave the intrinsic in place.

LGTM. Thanks.

@aengelke aengelke merged commit 85bf0a6 into llvm:main Aug 6, 2024
5 of 7 checks passed
@aengelke aengelke deleted the fix-preisel-lowering-2 branch August 6, 2024 17:30
@rofirrim
Copy link
Collaborator

rofirrim commented Aug 6, 2024

Thanks @aengelke

I'll take a look at CachingVPExpander::expandVectorPredication and see whether we can make it more reasonable so we don't assume we're changing things when the intrinsic is fully legal.

Currently it reads

// Return true if and only if the intrinsic was actually removed.

but I'm not sure why it should be like that. Maybe @simoll can shed some light on this.

@aengelke
Copy link
Contributor Author

aengelke commented Aug 6, 2024

I changed that. To include expandVectorPredication in PreISelIntrinsicLowering, I needed a way to determine whether the intrinsic was removed (i.e., whether to skip one entry in the use list of the intrinsic if it was not removed). What I think we would actually need are two return values: one indicating whether the intrinsic was removed and one indicating whether the code was changed at all.

@rofirrim
Copy link
Collaborator

rofirrim commented Aug 6, 2024

I changed that.

Ah ok. Sorry, I missed that.

What I think we would actually need are two return values: one indicating whether the intrinsic was removed and one indicating whether the code was changed at all.

I could not find any other user of CachingVPExpander::expandVectorPredication other than PreISelLowering. Looks like we do not have to tell apart the two cases and simply knowing something has changed would be enough.

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.

2 participants