Index: include/llvm/Target/Target.td =================================================================== --- include/llvm/Target/Target.td +++ include/llvm/Target/Target.td @@ -1173,7 +1173,7 @@ let hasSideEffects = 1; } def ICALL_BRANCH_FUNNEL : StandardPseudoInstruction { - let OutOperandList = (outs unknown:$dst); + let OutOperandList = (outs); let InOperandList = (ins variable_ops); let AsmString = ""; let hasSideEffects = 1; Index: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp =================================================================== --- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -6260,7 +6260,6 @@ case Intrinsic::icall_branch_funnel: { SmallVector Ops; - Ops.push_back(DAG.getRoot()); Ops.push_back(getValue(I.getArgOperand(0))); int64_t Offset; @@ -6303,6 +6302,8 @@ Ops.push_back(T.Target); } + Ops.push_back(DAG.getRoot()); // Chain + SDValue N(DAG.getMachineNode(TargetOpcode::ICALL_BRANCH_FUNNEL, getCurSDLoc(), MVT::Other, Ops), 0); Index: lib/Target/X86/X86ExpandPseudo.cpp =================================================================== --- lib/Target/X86/X86ExpandPseudo.cpp +++ lib/Target/X86/X86ExpandPseudo.cpp @@ -83,6 +83,8 @@ const GlobalValue *CombinedGlobal = JTInst->getOperand(1).getGlobal(); auto CmpTarget = [&](unsigned Target) { + if (Selector.isReg()) + MBB->addLiveIn(Selector.getReg()); BuildMI(*MBB, MBBI, DL, TII->get(X86::LEA64r), X86::R11) .addReg(X86::RIP) .addImm(1) @@ -98,6 +100,8 @@ auto CreateMBB = [&]() { auto *NewMBB = MF->CreateMachineBasicBlock(BB); MBB->addSuccessor(NewMBB); + if (!MBB->isLiveIn(X86::EFLAGS)) + MBB->addLiveIn(X86::EFLAGS); return NewMBB; }; Index: test/CodeGen/X86/icall-branch-funnel.ll =================================================================== --- test/CodeGen/X86/icall-branch-funnel.ll +++ test/CodeGen/X86/icall-branch-funnel.ll @@ -1,5 +1,4 @@ -; FIXME: Fix machine verifier issues and remove -verify-machineinstrs=0. PR39436. -; RUN: llc -mtriple=x86_64-unknown-linux -verify-machineinstrs=0 < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-unknown-linux < %s | FileCheck %s @g = external global i8 Index: test/ThinLTO/X86/cfi-devirt.ll =================================================================== --- test/ThinLTO/X86/cfi-devirt.ll +++ test/ThinLTO/X86/cfi-devirt.ll @@ -5,9 +5,7 @@ ; RUN: opt -thinlto-bc -o %t.o %s ; Legacy PM -; FIXME: Fix machine verifier issues and remove -verify-machineinstrs=0. PR39436. ; RUN: llvm-lto2 run %t.o -save-temps -pass-remarks=. \ -; RUN: -verify-machineinstrs=0 \ ; RUN: -o %t3 \ ; RUN: -r=%t.o,test,px \ ; RUN: -r=%t.o,_ZN1A1nEi,p \ @@ -24,9 +22,7 @@ ; RUN: llvm-dis %t3.1.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-IR ; New PM -; FIXME: Fix machine verifier issues and remove -verify-machineinstrs=0. PR39436. ; RUN: llvm-lto2 run %t.o -save-temps -use-new-pm -pass-remarks=. \ -; RUN: -verify-machineinstrs=0 \ ; RUN: -o %t3 \ ; RUN: -r=%t.o,test,px \ ; RUN: -r=%t.o,_ZN1A1nEi,p \ Index: test/ThinLTO/X86/devirt-after-icp.ll =================================================================== --- test/ThinLTO/X86/devirt-after-icp.ll +++ test/ThinLTO/X86/devirt-after-icp.ll @@ -45,9 +45,7 @@ ; RUN: opt -thinlto-bc -o %t.o %s ; Legacy PM -; FIXME: Fix machine verifier issues and remove -verify-machineinstrs=0. PR39436. ; RUN: llvm-lto2 run %t.o -save-temps -pass-remarks=. \ -; RUN: -verify-machineinstrs=0 \ ; RUN: -o %t3 \ ; RUN: -r=%t.o,_Z3bazP1A,px \ ; RUN: -r=%t.o,_ZN1A3fooEv, \ @@ -65,9 +63,7 @@ ; RUN: llvm-dis %t3.1.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-IR ; New PM -; FIXME: Fix machine verifier issues and remove -verify-machineinstrs=0. PR39436. ; RUN: llvm-lto2 run %t.o -save-temps -use-new-pm -pass-remarks=. \ -; RUN: -verify-machineinstrs=0 \ ; RUN: -o %t3 \ ; RUN: -r=%t.o,_Z3bazP1A,px \ ; RUN: -r=%t.o,_ZN1A3fooEv, \