Skip to content
Snippets Groups Projects
Commit fa0971b8 authored by Tim Northover's avatar Tim Northover Committed by Amara Emerson
Browse files

GlobalISel: check type size before getZExtValue()ing it.

Otherwise getZExtValue() asserts.

(cherry picked from commit c2b322fc)
parent d28af7c6
No related branches found
No related tags found
No related merge requests found
...@@ -840,9 +840,8 @@ void IRTranslator::emitSwitchCase(SwitchCG::CaseBlock &CB, ...@@ -840,9 +840,8 @@ void IRTranslator::emitSwitchCase(SwitchCG::CaseBlock &CB,
// For conditional branch lowering, we might try to do something silly like // For conditional branch lowering, we might try to do something silly like
// emit an G_ICMP to compare an existing G_ICMP i1 result with true. If so, // emit an G_ICMP to compare an existing G_ICMP i1 result with true. If so,
// just re-use the existing condition vreg. // just re-use the existing condition vreg.
if (CI && CI->getZExtValue() == 1 && if (MRI->getType(CondLHS).getSizeInBits() == 1 && CI &&
MRI->getType(CondLHS).getSizeInBits() == 1 && CI->getZExtValue() == 1 && CB.PredInfo.Pred == CmpInst::ICMP_EQ) {
CB.PredInfo.Pred == CmpInst::ICMP_EQ) {
Cond = CondLHS; Cond = CondLHS;
} else { } else {
Register CondRHS = getOrCreateVReg(*CB.CmpRHS); Register CondRHS = getOrCreateVReg(*CB.CmpRHS);
......
; RUN: llc -mtriple=arm64-apple-ios %s -o - -O0 -global-isel=1 | FileCheck %s
define void @foo(i512 %in) {
; CHECK-LABEL: foo:
; CHECK: cbz
switch i512 %in, label %default [
i512 3923188584616675477397368389504791510063972152790021570560, label %l1
i512 3923188584616675477397368389504791510063972152790021570561, label %l2
i512 3923188584616675477397368389504791510063972152790021570562, label %l3
]
default:
ret void
l1:
ret void
l2:
ret void
l3:
ret void
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment