Skip to content

Commit 1818943

Browse files
tltaoTony Tao
and
Tony Tao
authored
[SystemZ] Add check for INIT_UNDEF in getInstSizeInBytes (#134661)
Due to some optimization changes, INIT_UNDEF is making its way to `getInstSizeInBytes` in `llvm/lib/Target/SystemZ/SystemZLongBranch.cpp` but we do not have an exception there in the assert. Since INIT_UNDEF is described as being similar to IMPLICIT_DEF and there is a check for IMPLICIT_DEF, it seems logical to also add a check for INIT_UNDEF. --------- Co-authored-by: Tony Tao <[email protected]>
1 parent ed4c397 commit 1818943

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

llvm/lib/Target/SystemZ/SystemZLongBranch.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ static unsigned getInstSizeInBytes(const MachineInstr &MI,
216216
// These do not have a size:
217217
MI.isDebugOrPseudoInstr() || MI.isPosition() || MI.isKill() ||
218218
MI.isImplicitDef() || MI.getOpcode() == TargetOpcode::MEMBARRIER ||
219+
MI.getOpcode() == TargetOpcode::INIT_UNDEF ||
219220
// These have a size that may be zero:
220221
MI.isInlineAsm() || MI.getOpcode() == SystemZ::STACKMAP ||
221222
MI.getOpcode() == SystemZ::PATCHPOINT ||
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
2+
# REQUIRES: asserts
3+
# RUN: llc -run-pass systemz-long-branch -mtriple=s390x-ibm-zos -o - %s | FileCheck %s
4+
5+
# Makes sure INIT_UNDEF does not crash the compiler in systemz-long-branch
6+
---
7+
name: func0
8+
body: |
9+
bb.0.entry:
10+
; CHECK-LABEL: name: func0
11+
; CHECK: renamable $r0l = INIT_UNDEF
12+
; CHECK-NEXT: renamable $r3d = LGFR killed renamable $r0l
13+
; CHECK-NEXT: frame-destroy Return_XPLINK implicit $r3d
14+
renamable $r0l = INIT_UNDEF
15+
renamable $r3d = LGFR killed renamable $r0l
16+
frame-destroy Return_XPLINK implicit $r3d
17+
...

0 commit comments

Comments
 (0)