Skip to content

Commit 191be2a

Browse files
committed
update_test_checks: pre-commit a new test
The test shows that name preservation doesn't work properly when --include-generated-funcs is used.
1 parent 281d716 commit 191be2a

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --include-generated-funcs --version 3
2+
; RUN: opt < %s -S | FileCheck %s
3+
4+
; The assumption underlying this test is that there are pre-existing check lines
5+
; but something has changed, and we would like to avoid needless changes of
6+
; meta variable names so that diffs end up being easier to read, e.g. avoid
7+
; changing X_I33 into X_I34 or renumbering the various TMP variables.
8+
9+
define i32 @func({i32, i32} %x, i32 %y) {
10+
%x.i34 = extractvalue {i32, i32} %x, 0
11+
%1 = add i32 %y, 1
12+
%2 = add i32 %x.i34, %1
13+
%3 = mul i32 %2, 3
14+
ret i32 %3
15+
}
16+
17+
; CHECK-LABEL: define i32 @func(
18+
; CHECK-SAME: { i32, i32 } [[X:%.*]], i32 [[Y:%.*]]) {
19+
; CHECK-NEXT: [[X_I33:%.*]] = extractvalue { i32, i32 } [[X]], 0
20+
; CHECK-NEXT: [[TMP1:%.*]] = add i32 [[X_I33]], [[Y]]
21+
; CHECK-NEXT: [[TMP2:%.*]] = mul i32 [[TMP1]], 3
22+
; CHECK-NEXT: ret i32 [[TMP2]]
23+
;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --include-generated-funcs --version 3
2+
; RUN: opt < %s -S | FileCheck %s
3+
4+
; The assumption underlying this test is that there are pre-existing check lines
5+
; but something has changed, and we would like to avoid needless changes of
6+
; meta variable names so that diffs end up being easier to read, e.g. avoid
7+
; changing X_I33 into X_I34 or renumbering the various TMP variables.
8+
9+
define i32 @func({i32, i32} %x, i32 %y) {
10+
%x.i34 = extractvalue {i32, i32} %x, 0
11+
%1 = add i32 %y, 1
12+
%2 = add i32 %x.i34, %1
13+
%3 = mul i32 %2, 3
14+
ret i32 %3
15+
}
16+
17+
; CHECK-LABEL: define i32 @func(
18+
; CHECK-SAME: { i32, i32 } [[X:%.*]], i32 [[Y:%.*]]) {
19+
; CHECK-NEXT: [[X_I34:%.*]] = extractvalue { i32, i32 } [[X]], 0
20+
; CHECK-NEXT: [[TMP1:%.*]] = add i32 [[Y]], 1
21+
; CHECK-NEXT: [[TMP2:%.*]] = add i32 [[X_I34]], [[TMP1]]
22+
; CHECK-NEXT: [[TMP3:%.*]] = mul i32 [[TMP2]], 3
23+
; CHECK-NEXT: ret i32 [[TMP3]]
24+
;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# RUN: cp -f %S/Inputs/stable_ir_values_funcs.ll %t.ll && %update_test_checks %t.ll
2+
# RUN: diff -u %t.ll %S/Inputs/stable_ir_values_funcs.ll.expected

0 commit comments

Comments
 (0)