mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[CodeGen] Skip some instructions that shouldn't affect shrink-wrapping
r320606 checked for MI.isMetaInstruction which skips all DBG_VALUEs. This also skips IMPLICIT_DEFs and other instructions that may def / read a register. Differential Revision: https://reviews.llvm.org/D42119 llvm-svn: 322584
This commit is contained in:
parent
eea46f246c
commit
0884ff3ce3
@ -240,10 +240,6 @@ INITIALIZE_PASS_END(ShrinkWrap, DEBUG_TYPE, "Shrink Wrap Pass", false, false)
|
||||
|
||||
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');
|
||||
@ -252,6 +248,9 @@ bool ShrinkWrap::useOrDefCSROrFI(const MachineInstr &MI,
|
||||
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 @@ bool ShrinkWrap::useOrDefCSROrFI(const MachineInstr &MI,
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user