Skip to content

Commit 7b590b0

Browse files
authored
adding usedef chain test
1 parent 1823295 commit 7b590b0

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// RUN: mlir-opt %s --normalize --mlir-use-nameloc-as-prefix 2>&1 | FileCheck %s
2+
3+
// CHECK-LABEL: func.func @use_def(
4+
// CHECK-SAME: %arg0: i32) -> i32 {
5+
// CHECK: %vl36495$eafb0$ = arith.constant 4 : i32
6+
// CHECK: %vl43392$funcArg0-vl36495$ = arith.addi %arg0, %vl36495$eafb0$ : i32
7+
// CHECK: %vl36495$20b04$ = arith.constant 0 : i32
8+
// CHECK: %op27844$vl36495-vl43392$ = arith.addi %vl36495$20b04$, %vl43392$funcArg0-vl36495$ : i32
9+
// CHECK: %op27844$op27844-vl36495$ = arith.addi %op27844$vl36495-vl43392$, %vl36495$eafb0$ : i32
10+
// CHECK: %op15672$op27844-op27844$ = arith.addi %op27844$op27844-vl36495$, %op27844$vl36495-vl43392$ : i32
11+
// CHECK: %op15672$op15672-op27844$ = arith.addi %op15672$op27844-op27844$, %op27844$op27844-vl36495$ : i32
12+
// CHECK: %op15672$op15672-op15672$ = arith.addi %op15672$op15672-op27844$, %op15672$op27844-op27844$ : i32
13+
// CHECK: %op15672$op15672-op15672$_0 = arith.addi %op15672$op15672-op15672$, %op15672$op15672-op27844$ : i32
14+
// CHECK: %op15672$op15672-op15672$_1 = arith.addi %op15672$op15672-op15672$, %op15672$op15672-op15672$_0 : i32
15+
// CHECK: %op15672$op15672-op15672$_2 = arith.addi %op15672$op15672-op15672$, %op15672$op15672-op15672$_1 : i32
16+
// CHECK: %op15672$op15672-op15672$_3 = arith.addi %op15672$op15672-op15672$_1, %op15672$op15672-op15672$_2 : i32
17+
// CHECK: return %op15672$op15672-op15672$_3 : i32
18+
// CHECK: }
19+
module {
20+
func.func @use_def(%arg0: i32) -> i32 {
21+
%c0 = arith.constant 4 : i32
22+
%t = arith.addi %arg0, %c0 : i32
23+
%zero = arith.constant 0 : i32
24+
%t2 = arith.addi %t, %zero : i32
25+
%t3 = arith.addi %t2, %c0 : i32
26+
%t4 = arith.addi %t3, %t2 : i32
27+
%t5 = arith.addi %t4, %t3 : i32
28+
%t6 = arith.addi %t5, %t4 : i32
29+
%t7 = arith.addi %t6, %t5 : i32
30+
%t8 = arith.addi %t7, %t6 : i32
31+
%t9 = arith.addi %t8, %t6 : i32
32+
%t10 = arith.addi %t9, %t8 : i32
33+
return %t10 : i32
34+
}
35+
}

0 commit comments

Comments
 (0)