Skip to content

MachineFunction: Remove null check on TargetRegisterInfo #128480

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
Feb 24, 2025

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Feb 24, 2025

Targets are required to define this, it is not optional. Make the method
pure virtual to enforce this

Targets are required to define this, it is not optional. Make the method
pure virtual to enforce this
Copy link
Contributor Author

arsenm commented Feb 24, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@arsenm arsenm marked this pull request as ready for review February 24, 2025 08:27
Copy link
Collaborator

@RKSimon RKSimon left a comment

Choose a reason for hiding this comment

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

We've not used pure functions here before - are we happy with setting this precedent, and are there any other TargetSubtargetInfo functions that should be made pure?

@arsenm
Copy link
Contributor Author

arsenm commented Feb 24, 2025

We've not used pure functions here before - are we happy with setting this precedent, and are there any other TargetSubtargetInfo functions that should be made pure?

TargetInstrInfo / TargetRegisterInfo use an inconsistent mix of pure and cases with default implementations which are just llvm_unreachable. I don't think it matters, or why TargetSubtargetInfo would be any different.

In this case, I don't know why these aren't just required fields in the base class the subclass constructor is required to set

Copy link
Collaborator

@RKSimon RKSimon left a comment

Choose a reason for hiding this comment

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

LGTM - hopefully this will set a precedent to move to pure virtual functions where possible.

@arsenm arsenm merged commit db40592 into main Feb 24, 2025
15 checks passed
@arsenm arsenm deleted the users/arsenm/machine-function-remove-null-tri-check branch February 24, 2025 11:21
farzonl added a commit to farzonl/llvm-project that referenced this pull request Feb 24, 2025
1. Fix build break caused by llvm#126772 by adding `writeDISubrangeType`
   stub to `DXILBitcodeWriter.cpp`
2. Fix build break caused by llvm#128480 by adding implementation of pure virtual
   method `TargetSubtargetInfo::getRegisterInfo`
farzonl added a commit to farzonl/llvm-project that referenced this pull request Feb 24, 2025
1. Fix build break caused by llvm#126772 by adding `writeDISubrangeType`
   stub to `DXILBitcodeWriter.cpp`
2. Fix build break caused by llvm#128480 by adding implementation of pure virtual
   method `TargetSubtargetInfo::getRegisterInfo`
farzonl added a commit that referenced this pull request Feb 24, 2025
1. Fix build break caused by #126772 by adding `writeDISubrangeType`
stub to `DXILBitcodeWriter.cpp`
2. Fix build break caused by #128480 by adding implementation of pure
virtual method `TargetSubtargetInfo::getRegisterInfo`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants