Skip to content

Commit 016e67f

Browse files
Amanieutambry
andauthored
[AArch64][GlobalISel] Handle rtcGPR64RegClassID in AArch64RegisterBankInfo::getRegBankFromRegClass() (#77)
TargetRegisterInfo::getMinimalPhysRegClass() returns rtcGPR64RegClassID for X16 and X17, as it's the last matching class. This in turn gets passed to AArch64RegisterBankInfo::getRegBankFromRegClass(), which hits an unreachable. It seems sensible to handle this case, so copies from X16 and X17 work. Copying from X17 is used in inline assembly in libunwind for pointer authentication. Differential Revision: https://reviews.llvm.org/D85720 Co-authored-by: Raul Tambre <[email protected]>
1 parent 2c56ba7 commit 016e67f

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ AArch64RegisterBankInfo::getRegBankFromRegClass(const TargetRegisterClass &RC,
261261
case AArch64::GPR64common_and_GPR64noipRegClassID:
262262
case AArch64::GPR64noip_and_tcGPR64RegClassID:
263263
case AArch64::tcGPR64RegClassID:
264+
case AArch64::rtcGPR64RegClassID:
264265
case AArch64::WSeqPairsClassRegClassID:
265266
case AArch64::XSeqPairsClassRegClassID:
266267
return getRegBank(AArch64::GPRRegBankID);

llvm/test/CodeGen/AArch64/GlobalISel/regbankselect-default.mir

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575

7676
define void @test_gphi_ptr() { ret void }
7777

78+
define void @test_restricted_tail_call() { ret void }
79+
7880
...
7981

8082
---
@@ -888,3 +890,20 @@ body: |
888890
RET_ReallyLR implicit $x0
889891
890892
...
893+
894+
---
895+
name: test_restricted_tail_call
896+
legalized: true
897+
tracksRegLiveness: true
898+
body: |
899+
bb.0:
900+
liveins: $x16, $x17
901+
; CHECK-LABEL: name: test_restricted_tail_call
902+
; CHECK: liveins: $x16, $x17
903+
; CHECK: [[COPY:%[0-9]+]]:gpr(s64) = COPY $x16
904+
; CHECK: [[COPY1:%[0-9]+]]:gpr(s64) = COPY $x17
905+
; CHECK: RET_ReallyLR
906+
%0:_(s64) = COPY $x16
907+
%1:_(s64) = COPY $x17
908+
RET_ReallyLR
909+
...

0 commit comments

Comments
 (0)