summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp5
-rw-r--r--llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll8
2 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
index ebbed12943b..2b99a555858 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
@@ -71,6 +71,11 @@ LegalizerInfo::getAction(const InstrAspect &Aspect) const {
// These *have* to be implemented for now, they're the fundamental basis of
// how everything else is transformed.
+ // Nothing is going to go well with types that aren't a power of 2 yet, so
+ // don't even try because we might make things worse.
+ if (!isPowerOf2_64(Aspect.Type.getSizeInBits()))
+ return std::make_pair(Unsupported, LLT());
+
// FIXME: the long-term plan calls for expansion in terms of load/store (if
// they're not legal).
if (Aspect.Opcode == TargetOpcode::G_SEQUENCE ||
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
index e7b1f04e03b..304cd5eccc2 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
@@ -42,6 +42,7 @@ define [1 x double] @constant() {
; PHI. If so, we cannot complete the G_PHI and mustn't try or bad things
; happen.
; FALLBACK-WITH-REPORT-ERR: warning: Instruction selection used fallback path for pending_phis
+; FALLBACK-WITH-REPORT-OUT-LABEL: pending_phis:
define i32 @pending_phis(i1 %tst, i32 %val, i32* %addr) {
br i1 %tst, label %true, label %false
@@ -57,3 +58,10 @@ false:
br label %end
}
+
+; FALLBACK-WITH-REPORT-ERR: warning: Instruction selection used fallback path for odd_type
+; FALLBACK-WITH-REPORT-OUT-LABEL: odd_type:
+define void @odd_type(i42* %addr) {
+ %val42 = load i42, i42* %addr
+ ret void
+}
OpenPOWER on IntegriCloud