summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2018-08-30 07:18:19 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2018-08-30 07:18:19 +0000
commitf2edba8e439153c61390ec8f4122684049e049a7 (patch)
treea7e9f4363d183a7194408db0fd33c363a43a4040 /llvm/lib/CodeGen/MachineBasicBlock.cpp
parent015a147c9f903dc8a7b4d8b7009248c2bf64da43 (diff)
downloadbcm5719-llvm-f2edba8e439153c61390ec8f4122684049e049a7.tar.gz
bcm5719-llvm-f2edba8e439153c61390ec8f4122684049e049a7.zip
Don't count debug instructions towards neighborhood count
In computeRegisterLiveness, the max instructions to search was counting dbg_value instructions, which could potentially cause an observable codegen change from the presence of debug info. llvm-svn: 341028
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineBasicBlock.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index 71fdb0f90f2..3e040711052 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -1379,7 +1379,12 @@ MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI,
const_iterator I(Before);
// If this is the last insn in the block, don't search forwards.
if (I != end()) {
- for (++I; I != end() && N > 0; ++I, --N) {
+ for (++I; I != end() && N > 0; ++I) {
+ if (I->isDebugInstr())
+ continue;
+
+ --N;
+
MachineOperandIteratorBase::PhysRegInfo Info =
ConstMIOperands(*I).analyzePhysReg(Reg, TRI);
@@ -1416,6 +1421,11 @@ MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI,
do {
--I;
+ if (I->isDebugInstr())
+ continue;
+
+ --N;
+
MachineOperandIteratorBase::PhysRegInfo Info =
ConstMIOperands(*I).analyzePhysReg(Reg, TRI);
@@ -1440,7 +1450,8 @@ MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI,
// Register must be live if we read it.
if (Info.Read)
return LQR_Live;
- } while (I != begin() && --N > 0);
+
+ } while (I != begin() && N > 0);
}
// Did we get to the start of the block?
@@ -1454,7 +1465,6 @@ MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI,
return LQR_Dead;
}
-
// At this point we have no idea of the liveness of the register.
return LQR_Unknown;
}
OpenPOWER on IntegriCloud