Skip to content

[SystemZ] Add check for INIT_UNDEF in getInstSizeInBytes #134661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions llvm/lib/Target/SystemZ/SystemZLongBranch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ static unsigned getInstSizeInBytes(const MachineInstr &MI,
// These do not have a size:
MI.isDebugOrPseudoInstr() || MI.isPosition() || MI.isKill() ||
MI.isImplicitDef() || MI.getOpcode() == TargetOpcode::MEMBARRIER ||
MI.getOpcode() == TargetOpcode::INIT_UNDEF ||
// These have a size that may be zero:
MI.isInlineAsm() || MI.getOpcode() == SystemZ::STACKMAP ||
MI.getOpcode() == SystemZ::PATCHPOINT ||
Expand Down
17 changes: 17 additions & 0 deletions llvm/test/CodeGen/SystemZ/init-undef.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
# REQUIRES: asserts
# RUN: llc -run-pass systemz-long-branch -mtriple=s390x-ibm-zos -o - %s | FileCheck %s

# Makes sure INIT_UNDEF does not crash the compiler in systemz-long-branch
---
name: func0
body: |
bb.0.entry:
; CHECK-LABEL: name: func0
; CHECK: renamable $r0l = INIT_UNDEF
; CHECK-NEXT: renamable $r3d = LGFR killed renamable $r0l
; CHECK-NEXT: frame-destroy Return_XPLINK implicit $r3d
renamable $r0l = INIT_UNDEF
renamable $r3d = LGFR killed renamable $r0l
frame-destroy Return_XPLINK implicit $r3d
...
Loading