Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 344c4f2

Browse files
committed
[SystemZ] Implement getRepRegClassFor()
This method must return a valid register class, or the list-ilp isel scheduler will crash. For MVT::Untyped nullptr was previously returned, but now ADDR128BitRegClass is returned instead. This is needed just as long as list-ilp (and probably also list-hybrid) is still there. Review: Ulrich Weigand, A Trick https://reviews.llvm.org/D32802 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302649 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 0e72980 commit 344c4f2

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

lib/Target/SystemZ/SystemZISelLowering.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6352,3 +6352,12 @@ MachineBasicBlock *SystemZTargetLowering::EmitInstrWithCustomInserter(
63526352
llvm_unreachable("Unexpected instr type to insert");
63536353
}
63546354
}
6355+
6356+
// This is only used by the isel schedulers, and is needed only to prevent
6357+
// compiler from crashing when list-ilp is used.
6358+
const TargetRegisterClass *
6359+
SystemZTargetLowering::getRepRegClassFor(MVT VT) const {
6360+
if (VT == MVT::Untyped)
6361+
return &SystemZ::ADDR128BitRegClass;
6362+
return TargetLowering::getRepRegClassFor(VT);
6363+
}

lib/Target/SystemZ/SystemZISelLowering.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,8 @@ class SystemZTargetLowering : public TargetLowering {
590590
MachineBasicBlock *emitLoadAndTestCmp0(MachineInstr &MI,
591591
MachineBasicBlock *MBB,
592592
unsigned Opcode) const;
593+
594+
const TargetRegisterClass *getRepRegClassFor(MVT VT) const override;
593595
};
594596
} // end namespace llvm
595597

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 -pre-RA-sched=list-ilp | FileCheck %s
2+
;
3+
; Check that list-ilp scheduler does not crash due to SystemZ's current use
4+
; of MVT::Untyped.
5+
6+
define void @pr32723(i8) {
7+
; CHECK: .text
8+
BB:
9+
br label %CF245
10+
11+
CF245: ; preds = %CF245, %BB
12+
%Shuff57 = shufflevector <4 x i8> zeroinitializer, <4 x i8> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
13+
%Cmp84 = icmp uge i8 %0, undef
14+
br i1 %Cmp84, label %CF245, label %CF260
15+
16+
CF260: ; preds = %CF245
17+
%B156 = sdiv <4 x i8> %Shuff57, %Shuff57
18+
br label %CF255
19+
20+
CF255: ; preds = %CF255, %CF260
21+
%I186 = insertelement <4 x i8> %B156, i8 %0, i32 2
22+
br label %CF255
23+
}

0 commit comments

Comments
 (0)