[llvm-commits] [llvm] r122082 - /llvm/trunk/lib/CodeGen/MachineVerifier.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Dec 17 11:18:41 PST 2010


Author: stoklund
Date: Fri Dec 17 13:18:41 2010
New Revision: 122082

URL: http://llvm.org/viewvc/llvm-project?rev=122082&view=rev
Log:
Allow missing kill flags on an untied operand of a two-address instruction when
the operand uses the same register as a tied operand:

  %r1 = add %r1, %r1

If add were a three-address instruction, kill flags would be required on at
least one of the uses. Since it is a two-address instruction, the tied use
operand must not have a kill flag.

This change makes the kill flag on the untied use operand optional.

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

Modified: llvm/trunk/lib/CodeGen/MachineVerifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineVerifier.cpp?rev=122082&r1=122081&r2=122082&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineVerifier.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineVerifier.cpp Fri Dec 17 13:18:41 2010
@@ -625,7 +625,12 @@
             *OS << UseIdx << " is not live in " << LI << '\n';
           }
           // Verify isKill == LI.killedAt.
-          if (!MI->isRegTiedToDefOperand(MONum)) {
+          // Two-address instrs don't have kill flags on the tied operands, and
+          // we even allow
+          //   %r1 = add %r1, %r1
+          // without a kill flag on the untied operand.
+          // MI->findRegisterUseOperandIdx finds the first operand using reg.
+          if (!MI->isRegTiedToDefOperand(MI->findRegisterUseOperandIdx(Reg))) {
             // MI could kill register without a kill flag on MO.
             bool miKill = MI->killsRegister(Reg);
             bool liKill = LI.killedAt(UseIdx.getDefIndex());





More information about the llvm-commits mailing list