-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Reserve R9 on armv6 iOS 2.x #150835
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
Reserve R9 on armv6 iOS 2.x #150835
Conversation
@llvm/pr-subscribers-backend-arm Author: None (Un1q32) ChangesThe iOS 2.x ABI had R9 as a reserved register, 3.0 made it available, but support for the 2.x ABI was never added to LLVM. We only use the 2.x ABI on armv6 since before 3.0 armv6 was the only architecture supported by iOS. Full diff: https://github.com/llvm/llvm-project/pull/150835.diff 1 Files Affected:
diff --git a/llvm/lib/Target/ARM/ARMSubtarget.cpp b/llvm/lib/Target/ARM/ARMSubtarget.cpp
index 9f600e0c685ab..d6e226736ba66 100644
--- a/llvm/lib/Target/ARM/ARMSubtarget.cpp
+++ b/llvm/lib/Target/ARM/ARMSubtarget.cpp
@@ -227,7 +227,10 @@ void ARMSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
(Options.UnsafeFPMath || isTargetDarwin()))
HasNEONForFP = true;
- if (isRWPI())
+ if (isRWPI() ||
+ (isTargetIOS() &&
+ ARM::parseArch(TargetTriple.getArchName()) == ARM::ArchKind::ARMV6K &&
+ TargetTriple.isOSVersionLT(3, 0)))
ReserveR9 = true;
// If MVEVectorCostFactor is still 0 (has not been set to anything else), default it to 2
|
Should probably be armv6 and armv6k actually. |
All armv6 iOS devices were armv6k, and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't done the "archaeology" to check this, but it seems fine: IIUC the worst case fallout is that this hurts performance on a no-longer-supported platform, and best case is that it fixes this bug... so the tradeoff seems fine in light of that.
Co-authored-by: Jon Roelofs <[email protected]>
I actually have the hardware to test with, and I've been carrying this patch for a while in my personal clang builds. Without it anything non-trivial segfaults, and with it everything works. I can probably find where this is done in the old Apple GCC sources and link that here. |
I don't have merge access btw so I would appreciate it if someone else could merge this for me. |
The iOS 2.x ABI had R9 as a reserved register, 3.0 made it available, but support for the 2.x ABI was never added to LLVM. We only use the 2.x ABI on armv6 since before 3.0 armv6 was the only architecture supported by iOS.
The iOS 2.x ABI had R9 as a reserved register, 3.0 made it available, but support for the 2.x ABI was never added to LLVM. We only use the 2.x ABI on armv6 since before 3.0 armv6 was the only architecture supported by iOS.