Skip to content

Commit f9b03d0

Browse files
aemersonnikic
authored andcommitted
[AArch64][GlobalISel] Fix an crash in RBS due to a new regclass being added.
rdar://84674985
1 parent f08c12f commit f9b03d0

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
#include "AArch64RegisterBankInfo.h"
1515
#include "AArch64InstrInfo.h"
16+
#include "AArch64RegisterInfo.h"
17+
#include "MCTargetDesc/AArch64MCTargetDesc.h"
1618
#include "llvm/ADT/STLExtras.h"
1719
#include "llvm/ADT/SmallVector.h"
1820
#include "llvm/CodeGen/GlobalISel/RegisterBank.h"
@@ -271,6 +273,7 @@ AArch64RegisterBankInfo::getRegBankFromRegClass(const TargetRegisterClass &RC,
271273
case AArch64::WSeqPairsClassRegClassID:
272274
case AArch64::XSeqPairsClassRegClassID:
273275
case AArch64::MatrixIndexGPR32_12_15RegClassID:
276+
case AArch64::GPR64_with_sub_32_in_MatrixIndexGPR32_12_15RegClassID:
274277
return getRegBank(AArch64::GPRRegBankID);
275278
case AArch64::CCRRegClassID:
276279
return getRegBank(AArch64::CCRegBankID);
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2+
# RUN: llc -mtriple=aarch64 -run-pass=regbankselect -verify-machineinstrs %s -o - | FileCheck %s
3+
4+
# Check we don't crash because of an unhandled new regclass GPR64_with_sub_32_in_MatrixIndexGPR32_12_15RegClassID.
5+
---
6+
name: foo
7+
alignment: 4
8+
legalized: true
9+
tracksRegLiveness: true
10+
body: |
11+
bb.1:
12+
; CHECK-LABEL: name: foo
13+
; CHECK: [[DEF:%[0-9]+]]:gpr(s64) = G_IMPLICIT_DEF
14+
; CHECK-NEXT: $x0 = COPY [[DEF]](s64)
15+
; CHECK-NEXT: $x1 = COPY [[DEF]](s64)
16+
; CHECK-NEXT: $x2 = COPY [[DEF]](s64)
17+
; CHECK-NEXT: $x3 = COPY [[DEF]](s64)
18+
; CHECK-NEXT: $x4 = COPY [[DEF]](s64)
19+
; CHECK-NEXT: $x5 = COPY [[DEF]](s64)
20+
; CHECK-NEXT: $x6 = COPY [[DEF]](s64)
21+
; CHECK-NEXT: $x7 = COPY [[DEF]](s64)
22+
; CHECK-NEXT: $x8 = COPY [[DEF]](s64)
23+
; CHECK-NEXT: $x9 = COPY [[DEF]](s64)
24+
; CHECK-NEXT: $x10 = COPY [[DEF]](s64)
25+
; CHECK-NEXT: $x11 = COPY [[DEF]](s64)
26+
; CHECK-NEXT: $x12 = COPY [[DEF]](s64)
27+
; CHECK-NEXT: $x13 = COPY [[DEF]](s64)
28+
; CHECK-NEXT: $x14 = COPY [[DEF]](s64)
29+
; CHECK-NEXT: $x15 = COPY [[DEF]](s64)
30+
; CHECK-NEXT: $x16 = COPY [[DEF]](s64)
31+
; CHECK-NEXT: $x17 = COPY [[DEF]](s64)
32+
; CHECK-NEXT: INLINEASM &"svc 0", 1 /* sideeffect attdialect */, 10 /* regdef */, implicit-def $x0, 10 /* regdef */, implicit-def $x1, 10 /* regdef */, implicit-def $x2, 10 /* regdef */, implicit-def $x3, 10 /* regdef */, implicit-def $x4, 10 /* regdef */, implicit-def $x5, 10 /* regdef */, implicit-def $x6, 10 /* regdef */, implicit-def $x7, 10 /* regdef */, implicit-def $x8, 10 /* regdef */, implicit-def $x9, 10 /* regdef */, implicit-def $x10, 10 /* regdef */, implicit-def $x11, 10 /* regdef */, implicit-def $x12, 10 /* regdef */, implicit-def $x13, 10 /* regdef */, implicit-def $x14, 10 /* regdef */, implicit-def $x15, 10 /* regdef */, implicit-def $x16, 10 /* regdef */, implicit-def $x17, 9 /* reguse */, $x0, 9 /* reguse */, $x1, 9 /* reguse */, $x2, 9 /* reguse */, $x3, 9 /* reguse */, $x4, 9 /* reguse */, $x5, 9 /* reguse */, $x6, 9 /* reguse */, $x7, 9 /* reguse */, $x8, 9 /* reguse */, $x9, 9 /* reguse */, $x10, 9 /* reguse */, $x11, 9 /* reguse */, $x12, 9 /* reguse */, $x13, 9 /* reguse */, $x14, 9 /* reguse */, $x15, 9 /* reguse */, $x16, 9 /* reguse */, $x17
33+
; CHECK-NEXT: RET_ReallyLR
34+
%0:_(s64) = G_IMPLICIT_DEF
35+
$x0 = COPY %0(s64)
36+
$x1 = COPY %0(s64)
37+
$x2 = COPY %0(s64)
38+
$x3 = COPY %0(s64)
39+
$x4 = COPY %0(s64)
40+
$x5 = COPY %0(s64)
41+
$x6 = COPY %0(s64)
42+
$x7 = COPY %0(s64)
43+
$x8 = COPY %0(s64)
44+
$x9 = COPY %0(s64)
45+
$x10 = COPY %0(s64)
46+
$x11 = COPY %0(s64)
47+
$x12 = COPY %0(s64)
48+
$x13 = COPY %0(s64)
49+
$x14 = COPY %0(s64)
50+
$x15 = COPY %0(s64)
51+
$x16 = COPY %0(s64)
52+
$x17 = COPY %0(s64)
53+
INLINEASM &"svc 0", 1 /* sideeffect attdialect */, 10 /* regdef */, implicit-def $x0, 10 /* regdef */, implicit-def $x1, 10 /* regdef */, implicit-def $x2, 10 /* regdef */, implicit-def $x3, 10 /* regdef */, implicit-def $x4, 10 /* regdef */, implicit-def $x5, 10 /* regdef */, implicit-def $x6, 10 /* regdef */, implicit-def $x7, 10 /* regdef */, implicit-def $x8, 10 /* regdef */, implicit-def $x9, 10 /* regdef */, implicit-def $x10, 10 /* regdef */, implicit-def $x11, 10 /* regdef */, implicit-def $x12, 10 /* regdef */, implicit-def $x13, 10 /* regdef */, implicit-def $x14, 10 /* regdef */, implicit-def $x15, 10 /* regdef */, implicit-def $x16, 10 /* regdef */, implicit-def $x17, 9 /* reguse */, $x0, 9 /* reguse */, $x1, 9 /* reguse */, $x2, 9 /* reguse */, $x3, 9 /* reguse */, $x4, 9 /* reguse */, $x5, 9 /* reguse */, $x6, 9 /* reguse */, $x7, 9 /* reguse */, $x8, 9 /* reguse */, $x9, 9 /* reguse */, $x10, 9 /* reguse */, $x11, 9 /* reguse */, $x12, 9 /* reguse */, $x13, 9 /* reguse */, $x14, 9 /* reguse */, $x15, 9 /* reguse */, $x16, 9 /* reguse */, $x17
54+
RET_ReallyLR
55+
56+
...

0 commit comments

Comments
 (0)