blob: cd8f14b28844b4870e1e8f3cc784f1a14b47fd59 [file] [log] [blame]
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -run-pass register-coalescer %s -systemz-subreg-liveness -O3 -mtriple s390x-ibm-linux -mcpu z13 -o - | FileCheck %s
#
# When the coalescing tries to coalesce `%20 = COPY %18`,
# %18 has been coalesced all the way up to %15 = ROSBG.
# ROSBG has tied operands and can be commuted, thus it
# maybe possible to swap the arguments of ROSBG to coalesce
# this copy. That's what the coalescer attempts.
#
# This used to produce an assertion failure in the coalescer,
# because this particular coalescing trick is used only on
# full copy. Therefore we were asserting that all the subranges
# at the point of the copy had a value number.
# This is actually not true in that example, because %18 is
# only partial defined before being fully copied.
#
# PR40215.
# The coalescer should have been able to swap the operands of
# the OR, hence eliminating the copy of %20 and %18.
# This is also visible here because the ROSBG operand was LHS
# before the coalescer, now it is RHS.
---
name: main
alignment: 16
tracksRegLiveness: true
body: |
; CHECK-LABEL: name: main
; CHECK: bb.0:
; CHECK-NEXT: successors: %bb.1(0x80000000)
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[LGHI:%[0-9]+]]:addr64bit = LGHI -30
; CHECK-NEXT: [[LHIMux:%[0-9]+]]:grx32bit = LHIMux 1
; CHECK-NEXT: [[LHIMux1:%[0-9]+]]:grx32bit = LHIMux 0
; CHECK-NEXT: undef [[DEF:%[0-9]+]].subreg_l32:gr64bit = IMPLICIT_DEF
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: bb.1:
; CHECK-NEXT: successors: %bb.3(0x00000001), %bb.4(0x7fffffff)
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: CHIMux [[LHIMux]], 0, implicit-def $cc
; CHECK-NEXT: BRC 14, 6, %bb.3, implicit killed $cc
; CHECK-NEXT: J %bb.4
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: bb.2:
; CHECK-NEXT: successors:
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: STMux [[DEF]].subreg_l32, undef %8:addr64bit, 0, $noreg :: (store (s32) into `ptr undef`)
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: bb.3:
; CHECK-NEXT: successors:
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: bb.4:
; CHECK-NEXT: successors: %bb.5(0x30000000), %bb.6(0x50000000)
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[LAY:%[0-9]+]]:gr64bit = LAY [[LGHI]], 19838, $noreg
; CHECK-NEXT: [[LAY1:%[0-9]+]]:gr64bit = LAY [[LGHI]], 19840, $noreg
; CHECK-NEXT: [[LAY2:%[0-9]+]]:gr64bit = LAY [[LGHI]], 19844, $noreg
; CHECK-NEXT: [[LAY2:%[0-9]+]]:gr64bit = OGR [[LAY2]], [[LAY]], implicit-def dead $cc
; CHECK-NEXT: undef [[AHIMuxK:%[0-9]+]].subreg_l32:gr64bit = AHIMuxK [[LGHI]].subreg_l32, 19843, implicit-def dead $cc
; CHECK-NEXT: [[AHIMuxK:%[0-9]+]]:gr64bit = ROSBG [[AHIMuxK]], [[LAY2]], 32, 63, 0, implicit-def dead $cc
; CHECK-NEXT: [[DEF:%[0-9]+]].subreg_l32:gr64bit = OR [[DEF]].subreg_l32, [[AHIMuxK]].subreg_l32, implicit-def dead $cc
; CHECK-NEXT: [[DEF:%[0-9]+]]:gr64bit = ROSBG [[DEF]], [[LAY1]], 32, 63, 0, implicit-def dead $cc
; CHECK-NEXT: CHIMux [[LHIMux1]], 0, implicit-def $cc
; CHECK-NEXT: BRC 14, 6, %bb.6, implicit killed $cc
; CHECK-NEXT: J %bb.5
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: bb.5:
; CHECK-NEXT: successors: %bb.6(0x80000000)
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: bb.6:
; CHECK-NEXT: successors: %bb.2(0x00000001), %bb.7(0x7fffffff)
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[LGHI:%[0-9]+]]:addr64bit = nuw nsw LA [[LGHI]], 6, $noreg
; CHECK-NEXT: CGHI [[LGHI]], 0, implicit-def $cc
; CHECK-NEXT: BRC 14, 8, %bb.2, implicit killed $cc
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: bb.7:
; CHECK-NEXT: successors: %bb.1(0x80000000)
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: J %bb.1
bb.0:
%6:gr64bit = LGHI -30
%8:grx32bit = LHIMux 1
%21:grx32bit = LHIMux 0
%23:addr64bit = COPY killed %6
%24:gr32bit = IMPLICIT_DEF
bb.1:
successors: %bb.3(0x00000001), %bb.4(0x7fffffff)
%1:gr32bit = COPY killed %24
%0:addr64bit = COPY killed %23
CHIMux %8, 0, implicit-def $cc
BRC 14, 6, %bb.3, implicit killed $cc
J %bb.4
bb.2:
successors:
STMux killed %4, undef %22:addr64bit, 0, $noreg :: (store (s32) into `ptr undef`)
bb.3:
successors:
bb.4:
successors: %bb.5(0x30000000), %bb.6(0x50000000)
%2:gr64bit = LAY %0, 19838, $noreg
%3:gr64bit = LAY %0, 19840, $noreg
%9:gr64bit = LAY %0, 19844, $noreg
%10:gr64bit = COPY killed %9
%10:gr64bit = OGR %10, killed %2, implicit-def dead $cc
%11:gr32bit = COPY %0.subreg_l32
%12:gr32bit = AHIMuxK killed %11, 19843, implicit-def dead $cc
undef %13.subreg_l32:gr64bit = COPY killed %12
%15:gr64bit = COPY killed %13
%15:gr64bit = ROSBG %15, killed %10, 32, 63, 0, implicit-def dead $cc
%16:gr32bit = COPY killed %15.subreg_l32
%17:gr32bit = COPY killed %16
%17:gr32bit = OR %17, killed %1, implicit-def dead $cc
undef %18.subreg_l32:gr64bit = COPY killed %17
%20:gr64bit = COPY killed %18
%20:gr64bit = ROSBG %20, killed %3, 32, 63, 0, implicit-def dead $cc
CHIMux %21, 0, implicit-def $cc
BRC 14, 6, %bb.6, implicit killed $cc
J %bb.5
bb.5:
bb.6:
successors: %bb.2(0x00000001), %bb.7(0x7fffffff)
%4:grx32bit = COPY killed %20.subreg_l32
%5:gr64bit = nuw nsw LA killed %0, 6, $noreg
CGHI %5, 0, implicit-def $cc
BRC 14, 8, %bb.2, implicit killed $cc
bb.7:
%23:addr64bit = COPY killed %5
%24:gr32bit = COPY killed %4
J %bb.1
...