cse-pairs.ll
3.34 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -reassociate -early-cse -earlycse-debug-hash -S < %s | FileCheck %s
@num1 = local_unnamed_addr global i32 0, align 4
@num2 = local_unnamed_addr global i32 0, align 4
@num3 = local_unnamed_addr global i32 0, align 4
@num4 = local_unnamed_addr global i32 0, align 4
define signext i32 @twoPairs(i32 signext %0, i32 signext %1, i32 signext %2, i32 signext %3, i32 signext %4) {
; CHECK-LABEL: @twoPairs(
; CHECK-NEXT: [[TMP6:%.*]] = add i32 [[TMP2:%.*]], [[TMP0:%.*]]
; CHECK-NEXT: [[TMP7:%.*]] = add i32 [[TMP6]], [[TMP1:%.*]]
; CHECK-NEXT: [[TMP8:%.*]] = add i32 [[TMP7]], [[TMP3:%.*]]
; CHECK-NEXT: [[TMP9:%.*]] = add i32 [[TMP8]], [[TMP4:%.*]]
; CHECK-NEXT: store i32 [[TMP9]], i32* @num1, align 4
; CHECK-NEXT: store i32 [[TMP6]], i32* @num2, align 4
; CHECK-NEXT: [[TMP10:%.*]] = add nsw i32 [[TMP3]], [[TMP1]]
; CHECK-NEXT: store i32 [[TMP10]], i32* @num3, align 4
; CHECK-NEXT: ret i32 undef
;
%6 = add i32 %2, %0
%7 = add i32 %6, %1
%8 = add i32 %7, %3
%9 = add i32 %8, %4
store i32 %9, i32* @num1, align 4
%10 = add nsw i32 %2, %0
store i32 %10, i32* @num2, align 4
%11 = add nsw i32 %3, %1
store i32 %11, i32* @num3, align 4
ret i32 undef
}
define signext i32 @twoPairsAllOpInPairs(i32 signext %0, i32 signext %1, i32 signext %2, i32 signext %3) {
; CHECK-LABEL: @twoPairsAllOpInPairs(
; CHECK-NEXT: [[TMP5:%.*]] = add i32 [[TMP2:%.*]], [[TMP1:%.*]]
; CHECK-NEXT: [[TMP6:%.*]] = add i32 [[TMP5]], [[TMP0:%.*]]
; CHECK-NEXT: [[TMP7:%.*]] = add i32 [[TMP6]], [[TMP3:%.*]]
; CHECK-NEXT: store i32 [[TMP7]], i32* @num1, align 4
; CHECK-NEXT: store i32 [[TMP5]], i32* @num2, align 4
; CHECK-NEXT: [[TMP8:%.*]] = add nsw i32 [[TMP3]], [[TMP0]]
; CHECK-NEXT: store i32 [[TMP8]], i32* @num3, align 4
; CHECK-NEXT: ret i32 undef
;
%5 = add nsw i32 %0, %1
%6 = add nsw i32 %5, %2
%7 = add nsw i32 %6, %3
store i32 %7, i32* @num1, align 4
%8 = add nsw i32 %1, %2
store i32 %8, i32* @num2, align 4
%9 = add nsw i32 %0, %3
store i32 %9, i32* @num3, align 4
ret i32 undef
}
define signext i32 @threePairsAllOpInPairs(i32 signext %0, i32 signext %1, i32 signext %2, i32 signext %3, i32 signext %4, i32 signext %5) {
; CHECK-LABEL: @threePairsAllOpInPairs(
; CHECK-NEXT: [[TMP7:%.*]] = add i32 [[TMP3:%.*]], [[TMP2:%.*]]
; CHECK-NEXT: [[TMP8:%.*]] = add i32 [[TMP7]], [[TMP0:%.*]]
; CHECK-NEXT: [[TMP9:%.*]] = add i32 [[TMP8]], [[TMP1:%.*]]
; CHECK-NEXT: [[TMP10:%.*]] = add i32 [[TMP9]], [[TMP4:%.*]]
; CHECK-NEXT: [[TMP11:%.*]] = add i32 [[TMP10]], [[TMP5:%.*]]
; CHECK-NEXT: store i32 [[TMP11]], i32* @num1, align 4
; CHECK-NEXT: [[TMP12:%.*]] = add nsw i32 [[TMP5]], [[TMP0]]
; CHECK-NEXT: store i32 [[TMP12]], i32* @num2, align 4
; CHECK-NEXT: [[TMP13:%.*]] = add nsw i32 [[TMP4]], [[TMP1]]
; CHECK-NEXT: store i32 [[TMP13]], i32* @num3, align 4
; CHECK-NEXT: store i32 [[TMP7]], i32* @num4, align 4
; CHECK-NEXT: ret i32 undef
;
%7 = add nsw i32 %0, %1
%8 = add nsw i32 %7, %2
%9 = add nsw i32 %8, %3
%10 = add nsw i32 %9, %4
%11 = add nsw i32 %10, %5
store i32 %11, i32* @num1, align 4
%12 = add nsw i32 %0, %5
store i32 %12, i32* @num2, align 4
%13 = add nsw i32 %1, %4
store i32 %13, i32* @num3, align 4
%14 = add nsw i32 %2, %3
store i32 %14, i32* @num4, align 4
ret i32 undef
}