aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/RegAllocFast.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2023-03-03 13:11:58 -0400
committerMatt Arsenault <arsenm2@gmail.com>2023-04-05 18:25:51 -0400
commit7907fd49619f121df6feafd8ca524840bcb6d5da (patch)
tree134ce432040574d20a503b970c208d475a58b226 /llvm/lib/CodeGen/RegAllocFast.cpp
parent61c1ed86a581476e252cce2b34c769a540244ab5 (diff)
downloadllvm-7907fd49619f121df6feafd8ca524840bcb6d5da.zip
llvm-7907fd49619f121df6feafd8ca524840bcb6d5da.tar.gz
llvm-7907fd49619f121df6feafd8ca524840bcb6d5da.tar.bz2
RegAllocFast: Fix dropping subreg indexes on unassigned subreg defs
This was assuming all register operands were assigned to physical registers. This should ignore the operands which weren't assigned in this run. Fixes #61134
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocFast.cpp')
-rw-r--r--llvm/lib/CodeGen/RegAllocFast.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp
index 613e146..dd6f315 100644
--- a/llvm/lib/CodeGen/RegAllocFast.cpp
+++ b/llvm/lib/CodeGen/RegAllocFast.cpp
@@ -1321,9 +1321,11 @@ void RegAllocFast::allocateInstruction(MachineInstr &MI) {
if (!MO.isReg() || !MO.isDef())
continue;
+ Register Reg = MO.getReg();
+
// subreg defs don't free the full register. We left the subreg number
// around as a marker in setPhysReg() to recognize this case here.
- if (MO.getSubReg() != 0) {
+ if (Reg.isPhysical() && MO.getSubReg() != 0) {
MO.setSubReg(0);
continue;
}
@@ -1334,7 +1336,6 @@ void RegAllocFast::allocateInstruction(MachineInstr &MI) {
// Do not free tied operands and early clobbers.
if ((MO.isTied() && !TiedOpIsUndef(MO, I)) || MO.isEarlyClobber())
continue;
- Register Reg = MO.getReg();
if (!Reg)
continue;
if (Reg.isVirtual()) {