[llvm] r293550 - GlobalISel: correctly translate invoke when callee is a register.
Tim Northover via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 30 13:45:22 PST 2017
Author: tnorthover
Date: Mon Jan 30 15:45:21 2017
New Revision: 293550
URL: http://llvm.org/viewvc/llvm-project?rev=293550&view=rev
Log:
GlobalISel: correctly translate invoke when callee is a register.
This should fix the GlobalISel verifier.
Modified:
llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/trunk/test/CodeGen/AArch64/GlobalISel/irtranslator-exceptions.ll
Modified: llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp?rev=293550&r1=293549&r2=293550&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp Mon Jan 30 15:45:21 2017
@@ -737,7 +737,11 @@ bool IRTranslator::translateInvoke(const
for (auto &Arg: I.arg_operands())
Args.emplace_back(getOrCreateVReg(*Arg), Arg->getType());
- if (!CLI->lowerCall(MIRBuilder, MachineOperand::CreateGA(Fn, 0),
+ auto CalleeMO =
+ Fn ? MachineOperand::CreateGA(Fn, 0)
+ : MachineOperand::CreateReg(getOrCreateVReg(*Callee), false);
+
+ if (!CLI->lowerCall(MIRBuilder, CalleeMO,
CallLowering::ArgInfo(Res, I.getType()), Args))
return false;
Modified: llvm/trunk/test/CodeGen/AArch64/GlobalISel/irtranslator-exceptions.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/irtranslator-exceptions.ll?rev=293550&r1=293549&r2=293550&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/irtranslator-exceptions.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/irtranslator-exceptions.ll Mon Jan 30 15:45:21 2017
@@ -6,7 +6,7 @@ declare i32 @foo(i32)
declare i32 @__gxx_personality_v0(...)
declare i32 @llvm.eh.typeid.for(i8*)
-; CHECK: name: bar
+; CHECK-LABEL: name: bar
; CHECK: body:
; CHECK-NEXT: bb.1 (%ir-block.0):
; CHECK: successors: %[[GOOD:bb.[0-9]+.continue]]{{.*}}%[[BAD:bb.[0-9]+.broken]]
@@ -43,3 +43,17 @@ continue:
%res.good = insertvalue { i8*, i32 } undef, i32 %sel.int, 1
ret { i8*, i32 } %res.good
}
+
+; CHECK-LABEL: name: test_invoke_indirect
+; CHECK: [[CALLEE:%[0-9]+]](p0) = COPY %x0
+; CHECK: BLR [[CALLEE]]
+define void @test_invoke_indirect(void()* %callee) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+ invoke void %callee() to label %continue unwind label %broken
+
+broken:
+ landingpad { i8*, i32 } catch i8* bitcast(i8** @_ZTIi to i8*)
+ ret void
+
+continue:
+ ret void
+}
More information about the llvm-commits
mailing list