[llvm] r280698 - [RegisterScavenger] Remove aliasing registers of operands from the candidate set

Silviu Baranga via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 6 03:10:21 PDT 2016


Author: sbaranga
Date: Tue Sep  6 05:10:21 2016
New Revision: 280698

URL: http://llvm.org/viewvc/llvm-project?rev=280698&view=rev
Log:
[RegisterScavenger] Remove aliasing registers of operands from the candidate set

Summary:
In addition to not including the register operand of the current
instruction also don't include any aliasing registers. We can't consider
these as candidates because using them will clobber the corresponding
register operand of the current instruction.

This change doesn't include a test case and it would probably be difficult
to produce a stable one since the bug depends on the results of register
allocation.

Reviewers: MatzeB, qcolombet, hfinkel

Subscribers: hfinkel, llvm-commits

Differential Revision: https://reviews.llvm.org/D24130

Modified:
    llvm/trunk/lib/CodeGen/RegisterScavenging.cpp

Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterScavenging.cpp?rev=280698&r1=280697&r2=280698&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegisterScavenging.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Tue Sep  6 05:10:21 2016
@@ -419,7 +419,8 @@ unsigned RegScavenger::scavengeRegister(
   for (const MachineOperand &MO : MI.operands()) {
     if (MO.isReg() && MO.getReg() != 0 && !(MO.isUse() && MO.isUndef()) &&
         !TargetRegisterInfo::isVirtualRegister(MO.getReg()))
-      Candidates.reset(MO.getReg());
+      for (MCRegAliasIterator AI(MO.getReg(), TRI, true); AI.isValid(); ++AI)
+        Candidates.reset(*AI);
   }
 
   // Try to find a register that's unused if there is one, as then we won't




More information about the llvm-commits mailing list