]> granicus.if.org Git - llvm/commitdiff
[MachineOutliner][X86] Use TAILJMPd64 instead of JMP_1 for TailCall construction
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>
Mon, 30 Jul 2018 09:59:33 +0000 (09:59 +0000)
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>
Mon, 30 Jul 2018 09:59:33 +0000 (09:59 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338237 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86InstrInfo.cpp
test/CodeGen/X86/machine-outliner-tailcalls.ll

index 1b61accfb42b3148d7328ebf03ec6ae92abea2ab..96db8b4e7585db373b0132d1153a415a87e90c06 100644 (file)
@@ -7725,7 +7725,7 @@ X86InstrInfo::insertOutlinedCall(Module &M, MachineBasicBlock &MBB,
   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.
index 6f28354c386b6d93575d2a7302ca52db10e4cea2..71ebade623cf7a5cd72c60fce6677b1efd462037 100644 (file)
@@ -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