• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#RUN: not llc -o - -global-isel -run-pass=none -verify-machineinstrs %s 2>&1 | FileCheck %s
2# REQUIRES: global-isel, aarch64-registered-target
3--- |
4  ; ModuleID = 'test.ll'
5  source_filename = "test.ll"
6  target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
7  target triple = "aarch64-unknown-unknown"
8
9  define i32 @test_phi(i32 %argc) {
10  entry:
11    %cmp = icmp ugt i32 %argc, 0
12    br i1 %cmp, label %case1, label %case2
13
14  case1:                                            ; preds = %entry
15    %tmp11 = add i32 %argc, 1
16    br label %return
17
18  case2:                                            ; preds = %entry
19    %tmp22 = add i32 %argc, 2
20    br label %return
21
22  return:                                           ; preds = %case2, %case1
23    %res = phi i32 [ %tmp11, %case1 ], [ %tmp22, %case2 ]
24    ret i32 %res
25  }
26
27...
28---
29name:            test_phi
30legalized:       true
31regBankSelected: false
32selected:        false
33tracksRegLiveness: true
34registers:
35  - { id: 0, class: _, preferred-register: '' }
36  - { id: 1, class: _, preferred-register: '' }
37  - { id: 2, class: _, preferred-register: '' }
38  - { id: 3, class: _, preferred-register: '' }
39  - { id: 4, class: _, preferred-register: '' }
40  - { id: 5, class: _, preferred-register: '' }
41  - { id: 6, class: _, preferred-register: '' }
42  - { id: 7, class: _, preferred-register: '' }
43  - { id: 8, class: _, preferred-register: '' }
44  - { id: 9, class: _, preferred-register: '' }
45liveins:
46body:             |
47  bb.1.entry:
48    successors: %bb.2.case1(0x40000000), %bb.3.case2(0x40000000)
49    liveins: $w0
50    ; This test makes sure that the Verifier catches G_PHI with mismatching types.
51    ; CHECK: Bad machine code: Generic Instruction G_PHI has operands with incompatible/missing types
52
53    %0(s32) = COPY $w0
54    %1(s32) = G_CONSTANT i32 0
55    %3(s32) = G_CONSTANT i32 1
56    %5(s32) = G_CONSTANT i32 2
57    %8(s32) = G_ICMP intpred(ugt), %0(s32), %1
58    %2(s1) = G_TRUNC %8(s32)
59    G_BRCOND %2(s1), %bb.2.case1
60    G_BR %bb.3.case2
61
62  bb.2.case1:
63    successors: %bb.4.return(0x80000000)
64
65    %4(s32) = G_ADD %0, %3
66    %9(s16) = G_TRUNC %4(s32)
67    G_BR %bb.4.return
68
69  bb.3.case2:
70    successors: %bb.4.return(0x80000000)
71
72    %6(s32) = G_ADD %0, %5
73
74  bb.4.return:
75    %7(s32) = G_PHI %9(s16), %bb.2.case1, %6(s32), %bb.3.case2
76    $w0 = COPY %7(s32)
77    RET_ReallyLR implicit $w0
78
79...
80