From: Bill Wendling Date: Thu, 13 Oct 2011 07:42:32 +0000 (+0000) Subject: Should not add instructions to a BB after a return instruction. The machine instructi... X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=82222c20be24adda7c218f3fdaf2e0ae049c955b;hp=326e491ce7f7ad61014339c36a8cd90b33af98b9 Should not add instructions to a BB after a return instruction. The machine instruction verifier doesn't like this, nor do I. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141856 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/X86FrameLowering.cpp b/lib/Target/X86/X86FrameLowering.cpp index 23b071673de..757cef2d7f7 100644 --- a/lib/Target/X86/X86FrameLowering.cpp +++ b/lib/Target/X86/X86FrameLowering.cpp @@ -1414,11 +1414,12 @@ X86FrameLowering::adjustForSegmentedStacks(MachineFunction &MF) const { if (!Is64Bit) BuildMI(allocMBB, DL, TII.get(X86::ADD32ri), X86::ESP).addReg(X86::ESP) .addImm(8); - BuildMI(allocMBB, DL, TII.get(X86::RET)); if (Is64Bit && IsNested) BuildMI(allocMBB, DL, TII.get(X86::MOV64rr), X86::R10).addReg(X86::RAX); + BuildMI(allocMBB, DL, TII.get(X86::RET)); + allocMBB->addSuccessor(&prologueMBB); checkMBB->addSuccessor(allocMBB); checkMBB->addSuccessor(&prologueMBB); diff --git a/test/CodeGen/X86/segmented-stacks.ll b/test/CodeGen/X86/segmented-stacks.ll index 3f0067e2926..37f082c730a 100644 --- a/test/CodeGen/X86/segmented-stacks.ll +++ b/test/CodeGen/X86/segmented-stacks.ll @@ -81,7 +81,7 @@ define i32 @test_nested(i32 * nest %closure, i32 %other) { ; X64-NEXT: movabsq $0, %r10 ; X64-NEXT: movabsq $0, %r11 ; X64-NEXT: callq __morestack -; X64-NEXT: ret ; X64-NEXT: movq %rax, %r10 +; X64-NEXT: ret }