1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

[GlobalISel] Fallback when failing to translate invoke.

We unintentionally stopped falling back in r293670.

While there, change an unusual construct.

llvm-svn: 297425
This commit is contained in:
Ahmed Bougacha 2017-03-10 00:25:35 +00:00
parent 294f6c0958
commit b4377637bf
2 changed files with 24 additions and 3 deletions

View File

@ -787,7 +787,7 @@ bool IRTranslator::translateInvoke(const User &U,
const BasicBlock *ReturnBB = I.getSuccessor(0);
const BasicBlock *EHPadBB = I.getSuccessor(1);
const Value *Callee(I.getCalledValue());
const Value *Callee = I.getCalledValue();
const Function *Fn = dyn_cast<Function>(Callee);
if (isa<InlineAsm>(Callee))
return false;
@ -815,8 +815,9 @@ bool IRTranslator::translateInvoke(const User &U,
for (auto &Arg: I.arg_operands())
Args.push_back(getOrCreateVReg(*Arg));
CLI->lowerCall(MIRBuilder, I, Res, Args,
[&]() { return getOrCreateVReg(*I.getCalledValue()); });
if (!CLI->lowerCall(MIRBuilder, I, Res, Args,
[&]() { return getOrCreateVReg(*I.getCalledValue()); }))
return false;
MCSymbol *EndSymbol = Context.createTempSymbol();
MIRBuilder.buildInstr(TargetOpcode::EH_LABEL).addSym(EndSymbol);

View File

@ -118,3 +118,23 @@ define void @test_write_register_intrin() {
call void @llvm.write_register.i64(metadata !{!"sp"}, i64 0)
ret void
}
@_ZTIi = external global i8*
declare i32 @__gxx_personality_v0(...)
; Check that we fallback on invoke translation failures.
; FALLBACK-WITH-REPORT-ERR: remark: <unknown>:0:0: unable to translate instruction: invoke: ' invoke void %callee(i128 0)
; FALLBACK-WITH-REPORT-NEXT: to label %continue unwind label %broken' (in function: invoke_weird_type)
; FALLBACK-WITH-REPORT-ERR: warning: Instruction selection used fallback path for invoke_weird_type
; FALLBACK-WITH-REPORT-OUT-LABEL: invoke_weird_type:
define void @invoke_weird_type(void(i128)* %callee) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
invoke void %callee(i128 0)
to label %continue unwind label %broken
broken:
landingpad { i8*, i32 } catch i8* bitcast(i8** @_ZTIi to i8*)
ret void
continue:
ret void
}