aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2023-07-27 08:55:43 -0400
committerMatt Arsenault <Matthew.Arsenault@amd.com>2023-08-11 10:29:53 -0400
commit8f18cf77e79e1f1534d97220a14d684095f7b92a (patch)
treece7aa52d90910ea5214bcc1c25dafaaccff3af58 /llvm/lib/CodeGen/MachineInstr.cpp
parent1030483561d6abf0a160bca324509d0c7ef4e398 (diff)
downloadllvm-8f18cf77e79e1f1534d97220a14d684095f7b92a.zip
llvm-8f18cf77e79e1f1534d97220a14d684095f7b92a.tar.gz
llvm-8f18cf77e79e1f1534d97220a14d684095f7b92a.tar.bz2
AMDGPU: Check for implicit defs before constant folding instruction
Can't delete the constant folded instruction if scc is used. Fixes #63986 https://reviews.llvm.org/D157504
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 0c4353f..13673fb 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -1497,6 +1497,16 @@ bool MachineInstr::allDefsAreDead() const {
return true;
}
+bool MachineInstr::allImplicitDefsAreDead() const {
+ for (const MachineOperand &MO : implicit_operands()) {
+ if (!MO.isReg() || MO.isUse())
+ continue;
+ if (!MO.isDead())
+ return false;
+ }
+ return true;
+}
+
/// copyImplicitOps - Copy implicit register operands from specified
/// instruction to this instruction.
void MachineInstr::copyImplicitOps(MachineFunction &MF,