[llvm] [SystemZ] Add check for INIT_UNDEF in getInstSizeInBytes (PR #134661)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 7 07:43:59 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-systemz
Author: None (tltao)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/134661.diff
2 Files Affected:
- (modified) llvm/include/llvm/CodeGen/MachineInstr.h (+1)
- (modified) llvm/lib/Target/SystemZ/SystemZLongBranch.cpp (+1)
``````````diff
diff --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h
index 102b1eb07358e..cd7b3055ad722 100644
--- a/llvm/include/llvm/CodeGen/MachineInstr.h
+++ b/llvm/include/llvm/CodeGen/MachineInstr.h
@@ -1409,6 +1409,7 @@ class MachineInstr
}
bool isKill() const { return getOpcode() == TargetOpcode::KILL; }
bool isImplicitDef() const { return getOpcode()==TargetOpcode::IMPLICIT_DEF; }
+ bool isInitUndef() const { return getOpcode()==TargetOpcode::INIT_UNDEF; }
bool isInlineAsm() const {
return getOpcode() == TargetOpcode::INLINEASM ||
getOpcode() == TargetOpcode::INLINEASM_BR;
diff --git a/llvm/lib/Target/SystemZ/SystemZLongBranch.cpp b/llvm/lib/Target/SystemZ/SystemZLongBranch.cpp
index f19b932f3c731..f0f33c960d822 100644
--- a/llvm/lib/Target/SystemZ/SystemZLongBranch.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZLongBranch.cpp
@@ -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.isInitUndef() ||
// These have a size that may be zero:
MI.isInlineAsm() || MI.getOpcode() == SystemZ::STACKMAP ||
MI.getOpcode() == SystemZ::PATCHPOINT ||
``````````
</details>
https://github.com/llvm/llvm-project/pull/134661
More information about the llvm-commits
mailing list