Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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/CodeGen/LiveRangeEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink) {
continue;
MI->removeOperand(i-1);
}
MI->dropMemRefs(*MI->getMF());
LLVM_DEBUG(dbgs() << "Converted physregs to:\t" << *MI);
} else {
// If the dest of MI is an original reg and MI is reMaterializable,
Expand Down
52 changes: 52 additions & 0 deletions llvm/test/CodeGen/SystemZ/machine-ver-kill-memop.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# RUN: llc -o /dev/null %s -mtriple=s390x-linux-gnu -mcpu=z16 \
# RUN: -verify-machineinstrs -run-pass=register-coalescer

# Test that the MemoryOperand of the produced KILL instruction is removed
# and as a result the machine verifier succeeds.

--- |
define void @fun(ptr %Src, ptr %Dst, ptr %Src2) {
ret void
}
...
---
name: fun
alignment: 16
tracksRegLiveness: true
noPhis: true
isSSA: false
noVRegs: false
hasFakeUses: false
registers:
- { id: 0, class: grx32bit }
- { id: 1, class: grx32bit }
- { id: 2, class: grx32bit }
- { id: 3, class: addr64bit }
- { id: 4, class: gr64bit }
- { id: 5, class: grx32bit }
- { id: 6, class: grx32bit }
- { id: 7, class: grx32bit }
- { id: 8, class: addr64bit }
liveins:
- { reg: '$r2d', virtual-reg: '%3' }
frameInfo:
maxAlignment: 1
machineFunctionInfo: {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
alignment: 16
tracksRegLiveness: true
noPhis: true
isSSA: false
noVRegs: false
hasFakeUses: false
registers:
- { id: 0, class: grx32bit }
- { id: 1, class: grx32bit }
- { id: 2, class: grx32bit }
- { id: 3, class: addr64bit }
- { id: 4, class: gr64bit }
- { id: 5, class: grx32bit }
- { id: 6, class: grx32bit }
- { id: 7, class: grx32bit }
- { id: 8, class: addr64bit }
liveins:
- { reg: '$r2d', virtual-reg: '%3' }
frameInfo:
maxAlignment: 1
machineFunctionInfo: {}
tracksRegLiveness: true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, that line is already present further up...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to delete everything else, not add the line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, ofc, sorry.

body: |
bb.0:
liveins: $r2d

%3:addr64bit = COPY killed $r2d

bb.1:
%5:grx32bit = LMux killed %3, 0, $noreg :: (load (s32) from %ir.Src)
CHIMux killed %5, 0, implicit-def $cc
%7:grx32bit = LHIMux 0
%1:grx32bit = COPY killed %7
%1:grx32bit = LOCMux %1, undef %8:addr64bit, 0, 14, 6, implicit killed $cc :: (load (s32) from %ir.Src2)
dead %0:grx32bit = COPY killed %1

bb.2:
J %bb.2

...
Loading