]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGen/AArch64/GlobalISel/legalize-inttoptr-xfail-1.mir
Vendor import of llvm trunk r338150:
[FreeBSD/FreeBSD.git] / test / CodeGen / AArch64 / GlobalISel / legalize-inttoptr-xfail-1.mir
1 # RUN: not llc -mtriple=aarch64-- -run-pass=legalizer %s -o - 2>&1 | FileCheck %s
2 # REQUIRES: asserts
3
4 # This is to demonstrate what kind of bugs we're missing w/o some kind
5 # of validation for LegalizerInfo: G_INTTOPTR could only be legal /
6 # could be legalized if its destination operand has a pointer type and
7 # its source - a scalar type. This is reversed in this test and the
8 # legalizer is expected to fail on it with an appropriate error
9 # message. Prior to LegalizerInfo::verify AArch64 legalizer had a
10 # subtle bug in its definition that caused it to accept the following
11 # MIR as legal. Namely, it checked that type index 0 is either s64 or
12 # p0 (in that order) and implicitly declared any type for type index 1
13 # as legal. As LegalizerInfo::verify asserts on such a definition due
14 # to type index 1 not being covered it forces to review the definition
15 # and fix the mistake: check that type index 0 is p0 and type index 1
16 # is s64 (in that order).
17
18 # CHECK:      LLVM ERROR: unable to legalize instruction:
19 # CHECK-SAME: %{{[0-9]+}}:_(s64) = G_INTTOPTR %{{[0-9]+}}:_(p0)
20 # CHECK-SAME: (in function: broken)
21
22 ---
23 name:            broken
24 alignment:       2
25 tracksRegLiveness: true
26 registers:
27   - { id: 0, class: _ }
28   - { id: 1, class: _ }
29 body:             |
30   bb.1:
31     liveins: $x0
32
33     %0:_(p0) = COPY $x0
34     %1:_(s64) = G_INTTOPTR %0(p0)
35     $x0 = COPY %1(s64)
36     RET_ReallyLR implicit $x0
37
38 ...