aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
diff options
context:
space:
mode:
authorSam Parker <sam.parker@arm.com>2020-08-25 08:35:07 +0100
committerSam Parker <sam.parker@arm.com>2020-08-25 08:37:45 +0100
commit85a5c65f695deb13787889658cfcfbbfc1a42664 (patch)
tree7291fc5f85218394a92a3f962f8ecc62eb55994a /llvm/lib/CodeGen/ReachingDefAnalysis.cpp
parente3585ff7af17acda65bbdac66530bbf5f67fdbca (diff)
downloadllvm-85a5c65f695deb13787889658cfcfbbfc1a42664.zip
llvm-85a5c65f695deb13787889658cfcfbbfc1a42664.tar.gz
llvm-85a5c65f695deb13787889658cfcfbbfc1a42664.tar.bz2
[NFC][RDA] Add explicit def check
Explicitly check that there is a local def prior to the given instruction in getReachingLocalMIDef instead of just relying on a nullptr return from getInstFromId.
Diffstat (limited to 'llvm/lib/CodeGen/ReachingDefAnalysis.cpp')
-rw-r--r--llvm/lib/CodeGen/ReachingDefAnalysis.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
index dd70f91..4e18c7d 100644
--- a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
+++ b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
@@ -272,8 +272,10 @@ int ReachingDefAnalysis::getReachingDef(MachineInstr *MI, int PhysReg) const {
}
MachineInstr* ReachingDefAnalysis::getReachingLocalMIDef(MachineInstr *MI,
- int PhysReg) const {
- return getInstFromId(MI->getParent(), getReachingDef(MI, PhysReg));
+ int PhysReg) const {
+ return hasLocalDefBefore(MI, PhysReg)
+ ? getInstFromId(MI->getParent(), getReachingDef(MI, PhysReg))
+ : nullptr;
}
bool ReachingDefAnalysis::hasSameReachingDef(MachineInstr *A, MachineInstr *B,