File: invalid.mlir

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,999,216 kB
  • sloc: cpp: 6,951,711; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,033; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,252; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (42 lines) | stat: -rw-r--r-- 1,308 bytes parent folder | download | duplicates (17)
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
41
42
// RUN: mlir-opt %s -convert-cf-to-llvm | FileCheck %s

func.func @name(%flag: i32, %pred: i1){
    // Test cf.br lowering failure with type mismatch
    // CHECK: cf.br
    %c0 = arith.constant 0 : index
    cf.br ^bb1(%c0 : index)

  // Test cf.cond_br lowering failure with type mismatch in false_dest
  // CHECK: cf.cond_br
  ^bb1(%0: index):  // 2 preds: ^bb0, ^bb2
    %c1 = arith.constant 1 : i1
    %c2 = arith.constant 1 : index
    cf.cond_br %pred, ^bb2(%c1: i1), ^bb3(%c2: index)

  // Test cf.cond_br lowering failure with type mismatch in true_dest
  // CHECK: cf.cond_br
  ^bb2(%1: i1):
    %c3 = arith.constant 1 : i1
    %c4 = arith.constant 1 : index
    cf.cond_br %pred, ^bb3(%c4: index), ^bb2(%c3: i1)

  // Test cf.switch lowering failure with type mismatch in default case
  // CHECK: cf.switch
  ^bb3(%2: index):  // pred: ^bb1
    %c5 = arith.constant 1 : i1
    %c6 = arith.constant 1 : index
    cf.switch %flag : i32, [
      default: ^bb1(%c6 : index),
      42: ^bb4(%c5 : i1)
    ]

  // Test cf.switch lowering failure with type mismatch in non-default case
  // CHECK: cf.switch
  ^bb4(%3: i1):  // pred: ^bb1
    %c7 = arith.constant 1 : i1
    %c8 = arith.constant 1 : index
    cf.switch %flag : i32, [
      default: ^bb2(%c7 : i1),
      41: ^bb1(%c8 : index)
    ]
  }