Skip to content

Commit d413eae

Browse files
Updated and cleaned up test cases.
1 parent aedfeef commit d413eae

File tree

3 files changed

+28
-116
lines changed

3 files changed

+28
-116
lines changed

llvm/lib/CodeGen/RegisterCoalescer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3680,7 +3680,6 @@ bool RegisterCoalescer::joinVirtRegs(CoalescerPair &CP) {
36803680
CP.getDstIdx());
36813681
LHSVals.pruneMainSegments(LHS, ShrinkMainRange);
36823682
LHSVals.pruneSubRegValues(LHS, ShrinkMask);
3683-
RHSVals.pruneSubRegValues(LHS, ShrinkMask);
36843683
}
36853684

36863685
// The merging algorithm in LiveInterval::join() can't handle conflicting

llvm/test/CodeGen/PowerPC/subreg-coalescer.mir

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
1+
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
12
# RUN: llc -mtriple powerpc64le-unknown-linux-gnu -mcpu=pwr8 -x mir < %s \
2-
# RUN: -verify-machineinstrs --run-pass=register-coalescer -o - | FileCheck %s
3+
# RUN: -verify-coalescing --run-pass=register-coalescer -o - | FileCheck %s
34

45
---
56
name: check_subregs
67
alignment: 16
78
tracksRegLiveness: true
89
body: |
9-
bb.0.entry:
10+
bb.0:
1011
liveins: $x3
1112
13+
; CHECK-LABEL: name: check_subregs
14+
; CHECK: liveins: $x3
15+
; CHECK-NEXT: {{ $}}
16+
; CHECK-NEXT: [[COPY:%[0-9]+]]:g8rc_and_g8rc_nox0 = COPY $x3
17+
; CHECK-NEXT: [[LFSUX:%[0-9]+]]:f8rc, dead [[LFSUX1:%[0-9]+]]:g8rc_and_g8rc_nox0 = LFSUX [[COPY]], [[COPY]]
18+
; CHECK-NEXT: undef [[FRSP:%[0-9]+]].sub_64:vslrc = FRSP [[LFSUX]], implicit $rm
19+
; CHECK-NEXT: [[XVCVDPSP:%[0-9]+]]:vrrc = XVCVDPSP [[FRSP]], implicit $rm
20+
; CHECK-NEXT: $v2 = COPY [[XVCVDPSP]]
21+
; CHECK-NEXT: BLR8 implicit $lr8, implicit $rm, implicit $v2
1222
%0:g8rc_and_g8rc_nox0 = COPY $x3
13-
%3:f8rc, %4:g8rc_and_g8rc_nox0 = LFSUX %0, %0
14-
%5:f4rc = FRSP killed %3, implicit $rm
15-
%22:vslrc = SUBREG_TO_REG 1, %5, %subreg.sub_64
16-
%11:vrrc = XVCVDPSP killed %22, implicit $rm
17-
$v2 = COPY %11
23+
%1:f8rc, %2:g8rc_and_g8rc_nox0 = LFSUX %0, %0
24+
%3:f4rc = FRSP killed %1, implicit $rm
25+
%4:vslrc = SUBREG_TO_REG 1, %3, %subreg.sub_64
26+
%5:vrrc = XVCVDPSP killed %4, implicit $rm
27+
$v2 = COPY %5
1828
BLR8 implicit $lr8, implicit $rm, implicit $v2
1929
...
2030

21-
# CHECK: %0:g8rc_and_g8rc_nox0 = COPY $x3
22-
# CHECK-NEXT: %1:f8rc, dead %2:g8rc_and_g8rc_nox0 = LFSUX %0, %0
23-
# CHECK-NEXT: undef %4.sub_64:vslrc = FRSP %1, implicit $rm
24-
# CHECK-NEXT: %5:vrrc = XVCVDPSP %4, implicit $rm
25-
# CHECK-NEXT: $v2 = COPY %5
26-
# CHECK-NEXT: BLR8 implicit $lr8, implicit $rm, implicit $v2

llvm/test/CodeGen/X86/subreg-fail.mir

Lines changed: 11 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,22 @@
1+
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
12
# RUN: llc -mtriple x86_64-unknown-unknown -x mir < %s \
2-
# RUN: -verify-machineinstrs -enable-subreg-liveness=true \
3+
# RUN: -verify-coalescing -enable-subreg-liveness=true \
34
# RUN: --run-pass=register-coalescer -o - | FileCheck %s
45

5-
--- |
6-
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
7-
target triple = "x86_64-unknown-unknown"
8-
9-
%pair = type { i64, double }
10-
%t21 = type { ptr }
11-
%t13 = type { ptr, %t15, %t15 }
12-
%t15 = type { i8, i32, i32 }
13-
14-
@__force_order = external hidden global i32, align 4
15-
@.str = private unnamed_addr constant { [1 x i8], [63 x i8] } zeroinitializer, align 32
16-
@a = external global i32, align 4
17-
@fn1.g = private unnamed_addr constant [9 x ptr] [ptr null, ptr @a, ptr null, ptr null, ptr null, ptr null, ptr null, ptr null, ptr null], align 16
18-
@e = external global i32, align 4
19-
@__stack_chk_guard = external dso_local global ptr
20-
21-
; Function Attrs: nounwind ssp
22-
define i32 @test1() #0 {
23-
entry:
24-
%tmp5.i = load volatile i32, ptr undef, align 4
25-
%conv.i = zext i32 %tmp5.i to i64
26-
%tmp12.i = load volatile i32, ptr undef, align 4
27-
%conv13.i = zext i32 %tmp12.i to i64
28-
%shl.i = shl i64 %conv13.i, 32
29-
%or.i = or i64 %shl.i, %conv.i
30-
%add16.i = add i64 %or.i, 256
31-
%shr.i = lshr i64 %add16.i, 8
32-
%conv19.i = trunc i64 %shr.i to i32
33-
store volatile i32 %conv19.i, ptr undef, align 4
34-
ret i32 undef
35-
}
36-
...
376
---
387
name: test1
398
alignment: 16
40-
exposesReturnsTwice: false
41-
legalized: false
42-
regBankSelected: false
43-
selected: false
44-
failedISel: false
459
tracksRegLiveness: true
46-
hasWinCFI: false
47-
callsEHReturn: false
48-
callsUnwindInit: false
49-
hasEHCatchret: false
50-
hasEHScopes: false
51-
hasEHFunclets: false
52-
isOutlined: false
53-
debugInstrRef: true
54-
failsVerification: false
55-
tracksDebugUserValues: false
56-
registers:
57-
- { id: 0, class: gr32, preferred-register: '' }
58-
- { id: 1, class: gr64, preferred-register: '' }
59-
- { id: 2, class: gr64_nosp, preferred-register: '' }
60-
- { id: 3, class: gr32, preferred-register: '' }
61-
- { id: 4, class: gr64, preferred-register: '' }
62-
- { id: 5, class: gr64, preferred-register: '' }
63-
- { id: 6, class: gr64, preferred-register: '' }
64-
- { id: 7, class: gr64, preferred-register: '' }
65-
- { id: 8, class: gr64, preferred-register: '' }
66-
- { id: 9, class: gr32, preferred-register: '' }
67-
- { id: 10, class: gr64, preferred-register: '' }
68-
- { id: 11, class: gr32, preferred-register: '' }
69-
liveins: []
70-
frameInfo:
71-
isFrameAddressTaken: false
72-
isReturnAddressTaken: false
73-
hasStackMap: false
74-
hasPatchPoint: false
75-
stackSize: 0
76-
offsetAdjustment: 0
77-
maxAlignment: 1
78-
adjustsStack: false
79-
hasCalls: false
80-
stackProtector: ''
81-
functionContext: ''
82-
maxCallFrameSize: 4294967295
83-
cvBytesOfCalleeSavedRegisters: 0
84-
hasOpaqueSPAdjustment: false
85-
hasVAStart: false
86-
hasMustTailInVarArgFunc: false
87-
hasTailCall: false
88-
isCalleeSavedInfoValid: false
89-
localFrameSize: 0
90-
savePoint: ''
91-
restorePoint: ''
92-
fixedStack: []
93-
stack: []
94-
entry_values: []
95-
callSites: []
96-
debugValueSubstitutions: []
97-
constants: []
98-
machineFunctionInfo:
99-
amxProgModel: None
10010
body: |
101-
bb.0.entry:
11+
bb.0:
12+
; CHECK-LABEL: name: test1
13+
; CHECK: undef [[MOV32rm:%[0-9]+]].sub_32bit:gr64_nosp = MOV32rm undef %1:gr64, 1, $noreg, 0, $noreg :: (volatile load (s32) from `ptr undef`)
14+
; CHECK-NEXT: undef [[MOV32rm1:%[0-9]+]].sub_32bit:gr64_with_sub_8bit = MOV32rm undef %4:gr64, 1, $noreg, 0, $noreg :: (volatile load (s32) from `ptr undef`)
15+
; CHECK-NEXT: [[MOV32rm1:%[0-9]+]]:gr64_with_sub_8bit = SHL64ri [[MOV32rm1]], 32, implicit-def dead $eflags
16+
; CHECK-NEXT: [[LEA64r:%[0-9]+]]:gr64_with_sub_8bit = LEA64r [[MOV32rm1]], 1, [[MOV32rm]], 256, $noreg
17+
; CHECK-NEXT: [[LEA64r:%[0-9]+]]:gr64_with_sub_8bit = SHR64ri [[LEA64r]], 8, implicit-def dead $eflags
18+
; CHECK-NEXT: MOV32mr undef %10:gr64, 1, $noreg, 0, $noreg, [[LEA64r]].sub_32bit :: (volatile store (s32) into `ptr undef`)
19+
; CHECK-NEXT: RET 0, undef $eax
10220
%0:gr32 = MOV32rm undef %1:gr64, 1, $noreg, 0, $noreg :: (volatile load (s32) from `ptr undef`)
10321
%2:gr64_nosp = SUBREG_TO_REG 0, killed %0, %subreg.sub_32bit
10422
%3:gr32 = MOV32rm undef %4:gr64, 1, $noreg, 0, $noreg :: (volatile load (s32) from `ptr undef`)
@@ -113,12 +31,3 @@ body: |
11331
RET 0, undef $eax
11432
11533
...
116-
117-
# CHECK: undef %2.sub_32bit:gr64_nosp = MOV32rm undef %1:gr64, 1, $noreg, 0, $noreg :: (volatile load (s32) from `ptr undef`)
118-
# CHECK-NEXT: undef %6.sub_32bit:gr64_with_sub_8bit = MOV32rm undef %4:gr64, 1, $noreg, 0, $noreg :: (volatile load (s32) from `ptr undef`)
119-
# CHECK-NEXT: %6:gr64_with_sub_8bit = SHL64ri %6, 32, implicit-def dead $eflags
120-
# CHECK-NEXT: %8:gr64_with_sub_8bit = LEA64r %6, 1, %2, 256, $noreg
121-
# CHECK-NEXT: %8:gr64_with_sub_8bit = SHR64ri %8, 8, implicit-def dead $eflags
122-
# CHECK-NEXT: MOV32mr undef %10:gr64, 1, $noreg, 0, $noreg, %8.sub_32bit :: (volatile store (s32) into `ptr undef`)
123-
# CHECK-NEXT: RET 0, undef $eax
124-

0 commit comments

Comments
 (0)