summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2016-12-06 19:02:15 +0000
committerTim Northover <tnorthover@apple.com>2016-12-06 19:02:15 +0000
commit0a683e7bfd45d97a44c31c0a82fe80672136e1e5 (patch)
tree31b25e2f7e92a0fc782e462f798795eb94d55e31
parent1577b39f5169caeba91e19064fa88a724aed46a2 (diff)
downloadbcm5719-llvm-0a683e7bfd45d97a44c31c0a82fe80672136e1e5.tar.gz
bcm5719-llvm-0a683e7bfd45d97a44c31c0a82fe80672136e1e5.zip
GlobalISel: fall back gracefully when we hit unhandled legalizer default.
llvm-svn: 288840
-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