[llvm] r288840 - GlobalISel: fall back gracefully when we hit unhandled legalizer default.
Tim Northover via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 6 11:02:16 PST 2016
Author: tnorthover
Date: Tue Dec 6 13:02:15 2016
New Revision: 288840
URL: http://llvm.org/viewvc/llvm-project?rev=288840&view=rev
Log:
GlobalISel: fall back gracefully when we hit unhandled legalizer default.
Modified:
llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
Modified: llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp?rev=288840&r1=288839&r2=288840&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp Tue Dec 6 13:02:15 2016
@@ -93,7 +93,9 @@ LegalizerInfo::getAction(const InstrAspe
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);
}
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=288840&r1=288839&r2=288840&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll Tue Dec 6 13:02:15 2016
@@ -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
+}
More information about the llvm-commits
mailing list