[PATCH] D66570: [X86] Remove MCInstLower code that drops operands from some CALL and TAILJMP instructions. Add asserts to verify operand count

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 09:23:17 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL369665: [X86] Remove MCInstLower code that drops operands from some CALL and TAILJMP… (authored by ctopper, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D66570?vs=216529&id=216643#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66570/new/

https://reviews.llvm.org/D66570

Files:
  llvm/trunk/lib/Target/X86/X86MCInstLower.cpp


Index: llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
+++ llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
@@ -500,20 +500,16 @@
     break;
   }
 
-  // TAILJMPr64, CALL64r, CALL64pcrel32 - These instructions have register
-  // inputs modeled as normal uses instead of implicit uses.  As such, truncate
-  // off all but the first operand (the callee).  FIXME: Change isel.
+  // TAILJMPr64, CALL64r, CALL64pcrel32 - These instructions used to have
+  // register inputs modeled as normal uses instead of implicit uses.  As such,
+  // they we used to truncate off all but the first operand (the callee). This
+  // issue seems to have been fixed at some point. This assert verifies that.
   case X86::TAILJMPr64:
   case X86::TAILJMPr64_REX:
   case X86::CALL64r:
-  case X86::CALL64pcrel32: {
-    unsigned Opcode = OutMI.getOpcode();
-    MCOperand Saved = OutMI.getOperand(0);
-    OutMI = MCInst();
-    OutMI.setOpcode(Opcode);
-    OutMI.addOperand(Saved);
+  case X86::CALL64pcrel32:
+    assert(OutMI.getNumOperands() == 1 && "Unexpected number of operands!");
     break;
-  }
 
   case X86::EH_RETURN:
   case X86::EH_RETURN64: {
@@ -552,21 +548,15 @@
       goto SetTailJmpOpcode;
 
     SetTailJmpOpcode:
-      MCOperand Saved = OutMI.getOperand(0);
-      OutMI = MCInst();
+      assert(OutMI.getNumOperands() == 1 && "Unexpected number of operands!");
       OutMI.setOpcode(Opcode);
-      OutMI.addOperand(Saved);
       break;
     }
 
   case X86::TAILJMPd_CC:
   case X86::TAILJMPd64_CC: {
-    MCOperand Saved = OutMI.getOperand(0);
-    MCOperand Saved2 = OutMI.getOperand(1);
-    OutMI = MCInst();
+    assert(OutMI.getNumOperands() == 2 && "Unexpected number of operands!");
     OutMI.setOpcode(X86::JCC_1);
-    OutMI.addOperand(Saved);
-    OutMI.addOperand(Saved2);
     break;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66570.216643.patch
Type: text/x-patch
Size: 1929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190822/864df01b/attachment.bin>


More information about the llvm-commits mailing list