[llvm] r297425 - [GlobalISel] Fallback when failing to translate invoke.
Ahmed Bougacha via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 9 16:25:36 PST 2017
Author: ab
Date: Thu Mar 9 18:25:35 2017
New Revision: 297425
URL: http://llvm.org/viewvc/llvm-project?rev=297425&view=rev
Log:
[GlobalISel] Fallback when failing to translate invoke.
We unintentionally stopped falling back in r293670.
While there, change an unusual construct.
Modified:
llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
Modified: llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp?rev=297425&r1=297424&r2=297425&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp Thu Mar 9 18:25:35 2017
@@ -787,7 +787,7 @@ bool IRTranslator::translateInvoke(const
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
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);
Modified: llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll?rev=297425&r1=297424&r2=297425&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll Thu Mar 9 18:25:35 2017
@@ -118,3 +118,23 @@ define void @test_write_register_intrin(
call void @llvm.write_register.i64(metadata !{!"sp"}, i64 0)
ret void
}
+
+ at _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
+}
More information about the llvm-commits
mailing list