GlobalISel: fall back gracefully when we hit unhandled legalizer default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288840 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Tim Northover 2016-12-06 19:02:15 +00:00
parent 3074f79595
commit 9c3d059fa2
2 changed files with 11 additions and 1 deletions

View File

@ -93,7 +93,9 @@ LegalizerInfo::getAction(const InstrAspect &Aspect) const {
if (DefaultAction != DefaultActions.end() && DefaultAction->second == Legal)
return std::make_pair(Legal, Ty);
assert(DefaultAction->second == NarrowScalar && "unexpected default");
if (DefaultAction == DefaultActions.end() ||
DefaultAction->second != NarrowScalar)
return std::make_pair(Unsupported, LLT());
return findLegalAction(Aspect, NarrowScalar);
}

View File

@ -74,3 +74,11 @@ define void @odd_type(i42* %addr) {
define void @sequence_mapping([2 x i64] %in) {
ret void
}
; Legalizer was asserting when it enountered an unexpected default action.
; FALLBACK-WITH-REPORT-ERR: warning: Instruction selection used fallback path for legal_default
; FALLBACK-WITH-REPORT-LABEL: legal_default:
define void @legal_default(i64 %in) {
insertvalue [2 x i64] undef, i64 %in, 0
ret void
}