-
Notifications
You must be signed in to change notification settings - Fork 15.1k
clang crash assigning to a global named register variable #109778 #113105
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
Changes from all commits
ecbf43e
b8cd6f2
24822dc
6499176
8446c63
8e59839
99d202e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11519,17 +11519,14 @@ SDValue AArch64TargetLowering::LowerSPONENTRY(SDValue Op, | |
| Register AArch64TargetLowering:: | ||
| getRegisterByName(const char* RegName, LLT VT, const MachineFunction &MF) const { | ||
| Register Reg = MatchRegisterName(RegName); | ||
| if (AArch64::X1 <= Reg && Reg <= AArch64::X28) { | ||
| const AArch64RegisterInfo *MRI = Subtarget->getRegisterInfo(); | ||
| unsigned DwarfRegNum = MRI->getDwarfRegNum(Reg, false); | ||
| if (!Subtarget->isXRegisterReserved(DwarfRegNum) && | ||
| !MRI->isReservedReg(MF, Reg)) | ||
| Reg = 0; | ||
| } | ||
| if (Reg) | ||
| return Reg; | ||
| report_fatal_error(Twine("Invalid register name \"" | ||
| + StringRef(RegName) + "\".")); | ||
| if (Reg == AArch64::NoRegister) | ||
| report_fatal_error( | ||
| Twine("Invalid register name \"" + StringRef(RegName) + "\".")); | ||
| BitVector ReservedRegs = Subtarget->getRegisterInfo()->getReservedRegs(MF); | ||
| if (!ReservedRegs.test(Reg) && !Subtarget->isRegisterReservedByUser(Reg)) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is how other targets do it but AArch64 does not separate user reserved vs. reserved for ABI reasons (x18 is usually reserved for the OS to use). I think you can still improve the error message but it'll need to check ReserveXRegister. The tell tale sign this doesn't work is that nothing in AArch64 writes to UserReservedRegister but in RISCV and M68K they do (find in files or grep in I don't think it's worth moving AArch64 to the same style just for a better error though. I think the tests pass because for AArch64 I think if this becomes: That should work. Then remove the new bitset you added. Another way to do this is to keep the original code but instead of: report_fatal_error here with the improved message. |
||
| report_fatal_error(Twine("Trying to obtain non-reserved register \"" + | ||
| StringRef(RegName) + "\".")); | ||
| return Reg; | ||
| } | ||
|
|
||
| SDValue AArch64TargetLowering::LowerADDROFRETURNADDR(SDValue Op, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.