Skip to content

Commit f3147fa

Browse files
[AIE2P] Add a base test to detect missing undef flags in copy expansion.
The goal of this test is to check if we properly insert undef flag on the def side of a expanded full copy. On a sub-register def operand, it refers to the part of the register that isn't written. A sub-register def implicitly reads the other parts of the register being redefined unless the <undef> flag is set, and a missing flag can force the related register to be inserted in liveout set of the predecessors block, causing dominance problems. Co-Authored-By: Krishnam Tibrewala <[email protected]>
1 parent eb7c604 commit f3147fa

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
2+
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
3+
# See https://llvm.org/LICENSE.txt for license information.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
#
6+
# (c) Copyright 2025 Advanced Micro Devices, Inc. or its affiliates
7+
#
8+
# RUN: not --crash llc -O2 -mtriple=aie2p -start-before=greedy \
9+
# RUN: -stop-before=aie-unallocated-superreg-rewrite -o /dev/null %s 2>&1 | FileCheck %s
10+
11+
# The goal of this test is to check if we properly insert undef flag on the def side
12+
# of a expanded full copy. On a sub-register def operand, it refers to the part of the
13+
# register that isn't written. A sub-register def implicitly reads the other parts of the
14+
# register being redefined unless the <undef> flag is set, and a missing flag can
15+
# force the related register to be inserted in liveout set of the predecessors block,
16+
# causing dominance problems.
17+
18+
# CHECK: LLVM ERROR: Found 1 machine code errors
19+
20+
---
21+
name: use_all_2d_regs
22+
tracksRegLiveness: true
23+
body: |
24+
bb.0:
25+
successors: %bb.1(0x80000000)
26+
27+
undef %80.sub_dim_stride:ed = MOV_PD_imm11_pseudo 1
28+
%80.sub_mod:ed = MOV_PD_imm11_pseudo 0
29+
undef %105.sub_dim_size:ed = MOV_PD_imm11_pseudo -1
30+
%105.sub_mod:ed = COPY %80.sub_dim_stride
31+
%105.sub_dim_stride:ed = COPY %80.sub_mod
32+
undef %101.sub_dim_size:ed = COPY %80.sub_mod
33+
undef %97.sub_dim_size:ed = COPY %80.sub_mod
34+
undef %90.sub_dim_size:ed = COPY %80.sub_mod
35+
undef %86.sub_dim_size:ed = COPY %80.sub_mod
36+
undef %82.sub_dim_size:ed = COPY %80.sub_mod
37+
%80.sub_dim_size:ed = COPY %80.sub_mod
38+
%105.sub_dim_count:ed = COPY %80.sub_mod
39+
%97.sub_dim_count:ed = COPY %80.sub_mod
40+
%90.sub_dim_count:ed = COPY %80.sub_mod
41+
%101.sub_dim_count:ed = COPY %80.sub_mod
42+
undef %94.sub_dim_count:ed = COPY %80.sub_mod
43+
%86.sub_dim_count:ed = COPY %80.sub_mod
44+
%82.sub_dim_count:ed = COPY %80.sub_mod
45+
%80.sub_dim_count:ed = COPY %80.sub_mod
46+
undef %77.sub_dim_count:ed = COPY %80.sub_mod
47+
48+
bb.1:
49+
successors: %bb.1(0x80000000)
50+
51+
%10:ep = MOV_PD_imm11_pseudo 0
52+
%18:ep = MOV_PD_imm11_pseudo 0
53+
%22:ep = MOV_PD_imm11_pseudo 0
54+
%26:ep = MOV_PD_imm11_pseudo 0
55+
dead %10:ep, %105.sub_dim_count:ed = PADD_2D_pseudo_split %10, %105.sub_mod, %105.sub_dim_size, %105.sub_dim_stride, %105.sub_dim_count
56+
%30:ep = MOV_PD_imm11_pseudo 0
57+
%101.sub_mod:ed = COPY %105.sub_mod
58+
%101.sub_dim_stride:ed = COPY %105.sub_dim_stride
59+
dead %18:ep, %101.sub_dim_count:ed = PADD_2D_pseudo_split %18, %101.sub_mod, %101.sub_dim_size, %101.sub_dim_stride, %101.sub_dim_count
60+
%34:ep = MOV_PD_imm11_pseudo 0
61+
%97.sub_mod:ed = COPY %105.sub_mod
62+
%97.sub_dim_stride:ed = COPY %105.sub_dim_stride
63+
dead %22:ep, %97.sub_dim_count:ed = PADD_2D_pseudo_split %22, %97.sub_mod, %97.sub_dim_size, %97.sub_dim_stride, %97.sub_dim_count
64+
%94.sub_mod:ed = COPY %105.sub_mod
65+
%94.sub_dim_size:ed = COPY %105.sub_dim_size
66+
%38:ep = MOV_PD_imm11_pseudo 0
67+
%94.sub_dim_stride:ed = COPY %105.sub_dim_stride
68+
dead %26:ep, %94.sub_dim_count:ed = PADD_2D_pseudo_split %26, %94.sub_mod, %94.sub_dim_size, %94.sub_dim_stride, %94.sub_dim_count
69+
%90.sub_mod:ed = COPY %105.sub_mod
70+
%90.sub_dim_stride:ed = COPY %105.sub_dim_stride
71+
dead %30:ep, %90.sub_dim_count:ed = PADD_2D_pseudo_split %30, %90.sub_mod, %90.sub_dim_size, %90.sub_dim_stride, %90.sub_dim_count
72+
%42:ep = MOV_PD_imm11_pseudo 0
73+
%86.sub_mod:ed = COPY %105.sub_mod
74+
%86.sub_dim_stride:ed = COPY %105.sub_dim_stride
75+
dead %34:ep, %86.sub_dim_count:ed = PADD_2D_pseudo_split %34, %86.sub_mod, %86.sub_dim_size, %86.sub_dim_stride, %86.sub_dim_count
76+
dead %42:ep, %80.sub_dim_count:ed = PADD_2D_pseudo_split %42, %80.sub_mod, %80.sub_dim_size, %80.sub_dim_stride, %80.sub_dim_count
77+
%82.sub_mod:ed = COPY %105.sub_mod
78+
%46:ep = MOV_PD_imm11_pseudo 0
79+
%82.sub_dim_stride:ed = COPY %105.sub_dim_stride
80+
dead %38:ep, %82.sub_dim_count:ed = PADD_2D_pseudo_split %38, %82.sub_mod, %82.sub_dim_size, %82.sub_dim_stride, %82.sub_dim_count
81+
%77.sub_dim_size:ed = COPY %80.sub_mod
82+
%77.sub_mod:ed = COPY %80.sub_mod
83+
%77.sub_dim_stride:ed = COPY %105.sub_dim_stride
84+
dead %46:ep, %77.sub_dim_count:ed = PADD_2D_pseudo_split %46, %77.sub_mod, %77.sub_dim_size, %77.sub_dim_stride, %77.sub_dim_count
85+
PseudoJ_jump_imm %bb.1
86+
87+
...

0 commit comments

Comments
 (0)