[llvm] r338237 - [MachineOutliner][X86] Use TAILJMPd64 instead of JMP_1 for TailCall construction

Francis Visoiu Mistrih via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 30 02:59:33 PDT 2018


Author: thegameg
Date: Mon Jul 30 02:59:33 2018
New Revision: 338237

URL: http://llvm.org/viewvc/llvm-project?rev=338237&view=rev
Log:
[MachineOutliner][X86] Use TAILJMPd64 instead of JMP_1 for TailCall construction

The machine verifier asserts with:

Assertion failed: (isMBB() && "Wrong MachineOperand accessor"), function getMBB, file ../include/llvm/CodeGen/MachineOperand.h, line 542.

It calls analyzeBranch which tries to call getMBB if the opcode is
JMP_1, but in this case we do:

JMP_1 @OUTLINED_FUNCTION

I believe we have to use TAILJMPd64 instead of JMP_1 since JMP_1 is used
with brtarget8.

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

Modified:
    llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
    llvm/trunk/test/CodeGen/X86/machine-outliner-tailcalls.ll

Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=338237&r1=338236&r2=338237&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Mon Jul 30 02:59:33 2018
@@ -7725,7 +7725,7 @@ X86InstrInfo::insertOutlinedCall(Module
   if (C.CallConstructionID == MachineOutlinerTailCall) {
     // Yes, just insert a JMP.
     It = MBB.insert(It,
-                  BuildMI(MF, DebugLoc(), get(X86::JMP_1))
+                  BuildMI(MF, DebugLoc(), get(X86::TAILJMPd64))
                       .addGlobalAddress(M.getNamedValue(MF.getName())));
   } else {
     // No, insert a call.

Modified: llvm/trunk/test/CodeGen/X86/machine-outliner-tailcalls.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/machine-outliner-tailcalls.ll?rev=338237&r1=338236&r2=338237&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/machine-outliner-tailcalls.ll (original)
+++ llvm/trunk/test/CodeGen/X86/machine-outliner-tailcalls.ll Mon Jul 30 02:59:33 2018
@@ -1,4 +1,4 @@
-; RUN: llc -enable-machine-outliner -mtriple=x86_64-apple-darwin < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -enable-machine-outliner -mtriple=x86_64-apple-darwin < %s | FileCheck %s
 
 @x = common local_unnamed_addr global i32 0, align 4
 




More information about the llvm-commits mailing list