xref: /llvm-project/llvm/test/Transforms/MergeFunc/alloca.ll (revision ee2789001b8558656a13502f0de2c81dcb419430)
1f38f99bdSRoman Lebedev; RUN: opt -passes=mergefunc -S < %s | FileCheck %s
2cee313d2SEric Christopher
3cee313d2SEric Christopher;; Make sure that two different allocas are not treated as equal.
4cee313d2SEric Christopher
5cee313d2SEric Christophertarget datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
6cee313d2SEric Christopher
7cee313d2SEric Christopher%kv1 = type { i32, i32 }
8cee313d2SEric Christopher%kv2 = type { i8 }
9cee313d2SEric Christopher%kv3 = type { i64, i64 }
10cee313d2SEric Christopher
11cee313d2SEric Christopher; Size difference.
12cee313d2SEric Christopher
13cee313d2SEric Christopher; CHECK-LABEL: define void @size1
14cee313d2SEric Christopher; CHECK-NOT: call void @
15*ee278900SNikita Popovdefine void @size1(ptr %f) {
16cee313d2SEric Christopher  %v = alloca %kv1, align 8
17*ee278900SNikita Popov  call void %f(ptr %v)
18*ee278900SNikita Popov  call void %f(ptr %v)
19*ee278900SNikita Popov  call void %f(ptr %v)
20*ee278900SNikita Popov  call void %f(ptr %v)
21cee313d2SEric Christopher  ret void
22cee313d2SEric Christopher}
23cee313d2SEric Christopher
24cee313d2SEric Christopher; CHECK-LABEL: define void @size2
25cee313d2SEric Christopher; CHECK-NOT: call void @
26*ee278900SNikita Popovdefine void @size2(ptr %f) {
27cee313d2SEric Christopher  %v = alloca %kv2, align 8
28*ee278900SNikita Popov  call void %f(ptr %v)
29*ee278900SNikita Popov  call void %f(ptr %v)
30*ee278900SNikita Popov  call void %f(ptr %v)
31*ee278900SNikita Popov  call void %f(ptr %v)
32cee313d2SEric Christopher  ret void
33cee313d2SEric Christopher}
34cee313d2SEric Christopher
35cee313d2SEric Christopher; Alignment difference.
36cee313d2SEric Christopher
37cee313d2SEric Christopher; CHECK-LABEL: define void @align1
38cee313d2SEric Christopher; CHECK-NOT: call void @
39*ee278900SNikita Popovdefine void @align1(ptr %f) {
40cee313d2SEric Christopher  %v = alloca %kv3, align 8
41*ee278900SNikita Popov  call void %f(ptr %v)
42*ee278900SNikita Popov  call void %f(ptr %v)
43*ee278900SNikita Popov  call void %f(ptr %v)
44*ee278900SNikita Popov  call void %f(ptr %v)
45cee313d2SEric Christopher  ret void
46cee313d2SEric Christopher}
47cee313d2SEric Christopher
48cee313d2SEric Christopher; CHECK-LABEL: define void @align2
49cee313d2SEric Christopher; CHECK-NOT: call void @
50*ee278900SNikita Popovdefine void @align2(ptr %f) {
51cee313d2SEric Christopher  %v = alloca %kv3, align 16
52*ee278900SNikita Popov  call void %f(ptr %v)
53*ee278900SNikita Popov  call void %f(ptr %v)
54*ee278900SNikita Popov  call void %f(ptr %v)
55*ee278900SNikita Popov  call void %f(ptr %v)
56cee313d2SEric Christopher  ret void
57cee313d2SEric Christopher}
58