From: Tim Northover Date: Tue, 31 Jan 2017 20:12:18 +0000 (+0000) Subject: GlobalISel: the translation of an invoke must branch to the good block. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3b21070320734830ec7f05814fa3a87c923d9d83;p=llvm GlobalISel: the translation of an invoke must branch to the good block. Otherwise bad things happen if the basic block order isn't trivial after an invoke. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293679 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/GlobalISel/IRTranslator.cpp b/lib/CodeGen/GlobalISel/IRTranslator.cpp index 51613ab81f6..d8dc6a37a52 100644 --- a/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -749,6 +749,7 @@ bool IRTranslator::translateInvoke(const User &U, MF->addInvoke(&EHPadMBB, BeginSymbol, EndSymbol); MIRBuilder.getMBB().addSuccessor(&ReturnMBB); MIRBuilder.getMBB().addSuccessor(&EHPadMBB); + MIRBuilder.buildBr(ReturnMBB); return true; } diff --git a/test/CodeGen/AArch64/GlobalISel/irtranslator-exceptions.ll b/test/CodeGen/AArch64/GlobalISel/irtranslator-exceptions.ll index 9cb3923fd2a..5469c6c5634 100644 --- a/test/CodeGen/AArch64/GlobalISel/irtranslator-exceptions.ll +++ b/test/CodeGen/AArch64/GlobalISel/irtranslator-exceptions.ll @@ -15,6 +15,7 @@ declare i32 @llvm.eh.typeid.for(i8*) ; CHECK: BL @foo, csr_aarch64_aapcs, implicit-def %lr, implicit %sp, implicit %w0, implicit-def %w0 ; CHECK: {{%[0-9]+}}(s32) = COPY %w0 ; CHECK: EH_LABEL +; CHECK: G_BR %[[GOOD]] ; CHECK: [[BAD]] (landing-pad): ; CHECK: EH_LABEL