diff options
author | Sam Parker <sam.parker@arm.com> | 2020-02-27 10:54:08 +0000 |
---|---|---|
committer | Sam Parker <sam.parker@arm.com> | 2020-03-03 15:12:29 +0000 |
commit | dfe8f5da4c707c447b80ff5bf78313b35621d9c4 (patch) | |
tree | 6f16d43dd4e6948ce8011e6b6df77289e284e6a7 /llvm/lib/CodeGen/ReachingDefAnalysis.cpp | |
parent | f9896435c99b3288e1eba2b9226b56f603329cf1 (diff) | |
download | llvm-dfe8f5da4c707c447b80ff5bf78313b35621d9c4.zip llvm-dfe8f5da4c707c447b80ff5bf78313b35621d9c4.tar.gz llvm-dfe8f5da4c707c447b80ff5bf78313b35621d9c4.tar.bz2 |
[ARM][RDA] Allow multiple killed users
In RDA, check against the already decided dead instructions when
looking at users. This allows an instruction to be removed if it
has multiple users, but they're all dead.
This means that IT instructions can be considered killed once all
the itstate using instructions are dead.
Differential Revision: https://reviews.llvm.org/D75245
Diffstat (limited to 'llvm/lib/CodeGen/ReachingDefAnalysis.cpp')
-rw-r--r-- | llvm/lib/CodeGen/ReachingDefAnalysis.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp index 84029a0..5f0b4a9 100644 --- a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp +++ b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp @@ -547,7 +547,7 @@ ReachingDefAnalysis::isSafeToRemove(MachineInstr *MI, InstSet &Visited, void ReachingDefAnalysis::collectLocalKilledOperands(MachineInstr *MI, InstSet &Dead) const { Dead.insert(MI); - auto IsDead = [this](MachineInstr *Def, int PhysReg) { + auto IsDead = [this, &Dead](MachineInstr *Def, int PhysReg) { unsigned LiveDefs = 0; for (auto &MO : Def->operands()) { if (!isValidRegDef(MO)) @@ -561,7 +561,10 @@ void ReachingDefAnalysis::collectLocalKilledOperands(MachineInstr *MI, SmallPtrSet<MachineInstr*, 4> Uses; getGlobalUses(Def, PhysReg, Uses); - return Uses.size() == 1; + for (auto *Use : Uses) + if (!Dead.count(Use)) + return false; + return true; }; for (auto &MO : MI->operands()) { |