summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp4
-rw-r--r--llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll8
2 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
index 2b99a555858..e49662075ed 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
@@ -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);
}
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
index d164e2ea2f3..e4a2bb2dbf5 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
@@ -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
+}
OpenPOWER on IntegriCloud