1# RUN: not --crash llc -mtriple=aarch64-- -run-pass=legalizer %s -o - 2>&1 | FileCheck %s 2 3# This is to demonstrate what kind of bugs we're missing w/o some kind 4# of validation for LegalizerInfo: G_INTTOPTR could only be legal / 5# could be legalized if its destination operand has a pointer type and 6# its source - a scalar type of an appropriate size. This test meets 7# the requirements for type index 0 (the pointer) and LLT-size 8# requirements for type index 1 (64 bits for AArch64), but has a 9# non-scalar (vector) type for type index 1. The Legalizer is expected 10# to fail on it with an appropriate error message. Prior to 11# LegalizerInfo::verify AArch64 legalizer had a subtle bug in its 12# definition that caused it to accept the following MIR as legal. 13# Namely, it checked that type index 0 is either s64 or p0 and 14# implicitly declared any type for type index 1 as legal (as soon as 15# its size is 64 bits). As LegalizerInfo::verify asserts on such a 16# definition due to type index 1 not being covered by a specific 17# action (not just `unsupportedIf`) it forces to review the definition 18# and fix the mistake: check that type index 0 is p0 and type index 1 19# is s64. 20 21# CHECK: Bad machine code: operand types must be all-vector or all-scalar 22# CHECK: LLVM ERROR: Found 1 machine code errors. 23 24--- 25name: broken 26alignment: 4 27tracksRegLiveness: true 28registers: 29 - { id: 0, class: _ } 30 - { id: 1, class: _ } 31body: | 32 bb.1: 33 liveins: $d0 34 35 %0:_(<4 x s16>) = COPY $d0 36 %1:_(p0) = G_INTTOPTR %0(<4 x s16>) 37 $x0 = COPY %1(p0) 38 RET_ReallyLR implicit $x0 39 40... 41