File: legalize-inttoptr-xfail-2.mir

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (40 lines) | stat: -rw-r--r-- 1,606 bytes parent folder | download | duplicates (22)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# RUN: not --crash llc -mtriple=aarch64-- -run-pass=legalizer %s -o - 2>&1 | FileCheck %s

# This is to demonstrate what kind of bugs we're missing w/o some kind
# of validation for LegalizerInfo: G_INTTOPTR could only be legal /
# could be legalized if its destination operand has a pointer type and
# its source - a scalar type of an appropriate size. This test meets
# the requirements for type index 0 (the pointer) and LLT-size
# requirements for type index 1 (64 bits for AArch64), but has a
# non-scalar (vector) type for type index 1. The Legalizer is expected
# to fail on it with an appropriate error message. Prior to
# LegalizerInfo::verify AArch64 legalizer had a subtle bug in its
# definition that caused it to accept the following MIR as legal.
# Namely, it checked that type index 0 is either s64 or p0 and
# implicitly declared any type for type index 1 as legal (as soon as
# its size is 64 bits). As LegalizerInfo::verify asserts on such a
# definition due to type index 1 not being covered by a specific
# action (not just `unsupportedIf`) it forces to review the definition
# and fix the mistake: check that type index 0 is p0 and type index 1
# is s64.

# CHECK: Bad machine code: operand types must be all-vector or all-scalar
# CHECK: LLVM ERROR: Found 1 machine code errors.

---
name:            broken
alignment:       4
tracksRegLiveness: true
registers:
  - { id: 0, class: _ }
  - { id: 1, class: _ }
body:             |
  bb.1:
    liveins: $d0

    %0:_(<4 x s16>) = COPY $d0
    %1:_(p0) = G_INTTOPTR %0(<4 x s16>)
    $x0 = COPY %1(p0)
    RET_ReallyLR implicit $x0

...