[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:56:46 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL322584: [CodeGen] Skip some instructions that shouldn't affect shrink-wrapping (authored by thegameg, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D42119?vs=129994&id=129999#toc
Repository:
rL LLVM
https://reviews.llvm.org/D42119
Files:
llvm/trunk/lib/CodeGen/ShrinkWrap.cpp
Index: llvm/trunk/lib/CodeGen/ShrinkWrap.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/ShrinkWrap.cpp
+++ llvm/trunk/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.129999.patch
Type: text/x-patch
Size: 1328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180116/5b095a14/attachment.bin>
More information about the llvm-commits
mailing list