[PATCH] D42119: [CodeGen] Skip some instructions that shouldn't affect shrink-wrapping
Francis Visoiu Mistrih via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 16 10:52:41 PST 2018
thegameg created this revision.
thegameg added reviewers: MatzeB, qcolombet, aprantl.
r320606 <https://reviews.llvm.org/rL320606> checked for `MI.isMetaInstruction` which skips all DBG_VALUEs.
This also skips `IMPLICIT_DEFs` and other instructions that may def / read a register.
https://reviews.llvm.org/D42119
Files:
lib/CodeGen/ShrinkWrap.cpp
Index: lib/CodeGen/ShrinkWrap.cpp
===================================================================
--- lib/CodeGen/ShrinkWrap.cpp
+++ lib/CodeGen/ShrinkWrap.cpp
@@ -240,18 +240,17 @@
bool ShrinkWrap::useOrDefCSROrFI(const MachineInstr &MI,
RegScavenger *RS) const {
- // Ignore DBG_VALUE and other meta instructions that must not affect codegen.
- if (MI.isMetaInstruction())
- return false;
-
if (MI.getOpcode() == FrameSetupOpcode ||
MI.getOpcode() == FrameDestroyOpcode) {
DEBUG(dbgs() << "Frame instruction: " << MI << '\n');
return true;
}
for (const MachineOperand &MO : MI.operands()) {
bool UseOrDefCSR = false;
if (MO.isReg()) {
+ // Ignore instructions like DBG_VALUE which don't read/def the register.
+ if (!MO.isDef() && !MO.readsReg())
+ continue;
unsigned PhysReg = MO.getReg();
if (!PhysReg)
continue;
@@ -267,7 +266,8 @@
}
}
}
- if (UseOrDefCSR || MO.isFI()) {
+ // Skip FrameIndex operands in DBG_VALUE instructions.
+ if (UseOrDefCSR || (MO.isFI() && !MI.isDebugValue())) {
DEBUG(dbgs() << "Use or define CSR(" << UseOrDefCSR << ") or FI("
<< MO.isFI() << "): " << MI << '\n');
return true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42119.129994.patch
Type: text/x-patch
Size: 1295 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180116/ed5fad24/attachment.bin>
More information about the llvm-commits
mailing list