• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -mergefunc -S < %s | FileCheck %s
2
3;; Make sure that two different allocas are not treated as equal.
4
5target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
6
7%kv1 = type { i32, i32 }
8%kv2 = type { i8 }
9%kv3 = type { i64, i64 }
10
11; Size difference.
12
13; CHECK-LABEL: define void @size1
14; CHECK-NOT: call void @
15define void @size1(i8 *%f) {
16  %v = alloca %kv1, align 8
17  %f_2 = bitcast i8* %f to void (%kv1 *)*
18  call void %f_2(%kv1 * %v)
19  call void %f_2(%kv1 * %v)
20  call void %f_2(%kv1 * %v)
21  call void %f_2(%kv1 * %v)
22  ret void
23}
24
25; CHECK-LABEL: define void @size2
26; CHECK-NOT: call void @
27define void @size2(i8 *%f) {
28  %v = alloca %kv2, align 8
29  %f_2 = bitcast i8* %f to void (%kv2 *)*
30  call void %f_2(%kv2 * %v)
31  call void %f_2(%kv2 * %v)
32  call void %f_2(%kv2 * %v)
33  call void %f_2(%kv2 * %v)
34  ret void
35}
36
37; Alignment difference.
38
39; CHECK-LABEL: define void @align1
40; CHECK-NOT: call void @
41define void @align1(i8 *%f) {
42  %v = alloca %kv3, align 8
43  %f_2 = bitcast i8* %f to void (%kv3 *)*
44  call void %f_2(%kv3 * %v)
45  call void %f_2(%kv3 * %v)
46  call void %f_2(%kv3 * %v)
47  call void %f_2(%kv3 * %v)
48  ret void
49}
50
51; CHECK-LABEL: define void @align2
52; CHECK-NOT: call void @
53define void @align2(i8 *%f) {
54  %v = alloca %kv3, align 16
55  %f_2 = bitcast i8* %f to void (%kv3 *)*
56  call void %f_2(%kv3 * %v)
57  call void %f_2(%kv3 * %v)
58  call void %f_2(%kv3 * %v)
59  call void %f_2(%kv3 * %v)
60  ret void
61}
62