• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -metarenamer -S < %s | FileCheck %s
2; RUN: opt -passes=metarenamer -S < %s | FileCheck %s
3
4; CHECK: target triple {{.*}}
5; CHECK-NOT: {{^x*}}xxx{{^x*}}
6; CHECK: ret i32 6
7
8target triple = "x86_64-pc-linux-gnu"
9
10%struct.bar_xxx = type { i32, double }
11%struct.foo_xxx = type { i32, float, %struct.bar_xxx }
12
13@func_5_xxx.static_local_3_xxx = internal global i32 3, align 4
14@global_3_xxx = common global i32 0, align 4
15
16@func_7_xxx = weak alias i32 (...), i32 (...)* @aliased_func_7_xxx
17
18define i32 @aliased_func_7_xxx(...) {
19  ret i32 0
20}
21
22define i32 @func_3_xxx() nounwind uwtable ssp {
23  ret i32 3
24}
25
26define void @func_4_xxx(%struct.foo_xxx* sret(%struct.foo_xxx) %agg.result) nounwind uwtable ssp {
27  %1 = alloca %struct.foo_xxx, align 8
28  %2 = getelementptr inbounds %struct.foo_xxx, %struct.foo_xxx* %1, i32 0, i32 0
29  store i32 1, i32* %2, align 4
30  %3 = getelementptr inbounds %struct.foo_xxx, %struct.foo_xxx* %1, i32 0, i32 1
31  store float 2.000000e+00, float* %3, align 4
32  %4 = getelementptr inbounds %struct.foo_xxx, %struct.foo_xxx* %1, i32 0, i32 2
33  %5 = getelementptr inbounds %struct.bar_xxx, %struct.bar_xxx* %4, i32 0, i32 0
34  store i32 3, i32* %5, align 4
35  %6 = getelementptr inbounds %struct.bar_xxx, %struct.bar_xxx* %4, i32 0, i32 1
36  store double 4.000000e+00, double* %6, align 8
37  %7 = bitcast %struct.foo_xxx* %agg.result to i8*
38  %8 = bitcast %struct.foo_xxx* %1 to i8*
39  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %7, i8* align 8 %8, i64 24, i1 false)
40  ret void
41}
42
43declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind
44
45define i32 @func_5_xxx(i32 %arg_1_xxx, i32 %arg_2_xxx, i32 %arg_3_xxx, i32 %arg_4_xxx) nounwind uwtable ssp {
46  %1 = alloca i32, align 4
47  %2 = alloca i32, align 4
48  %3 = alloca i32, align 4
49  %4 = alloca i32, align 4
50  %local_1_xxx = alloca i32, align 4
51  %local_2_xxx = alloca i32, align 4
52  %i = alloca i32, align 4
53  store i32 %arg_1_xxx, i32* %1, align 4
54  store i32 %arg_2_xxx, i32* %2, align 4
55  store i32 %arg_3_xxx, i32* %3, align 4
56  store i32 %arg_4_xxx, i32* %4, align 4
57  store i32 1, i32* %local_1_xxx, align 4
58  store i32 2, i32* %local_2_xxx, align 4
59  store i32 0, i32* %i, align 4
60  br label %5
61
62; <label>:5                                       ; preds = %9, %0
63  %6 = load i32, i32* %i, align 4
64  %7 = icmp slt i32 %6, 10
65  br i1 %7, label %8, label %12
66
67; <label>:8                                       ; preds = %5
68  br label %9
69
70; <label>:9                                       ; preds = %8
71  %10 = load i32, i32* %i, align 4
72  %11 = add nsw i32 %10, 1
73  store i32 %11, i32* %i, align 4
74  br label %5
75
76; <label>:12                                      ; preds = %5
77  %13 = load i32, i32* %local_1_xxx, align 4
78  %14 = load i32, i32* %1, align 4
79  %15 = add nsw i32 %13, %14
80  %16 = load i32, i32* %local_2_xxx, align 4
81  %17 = add nsw i32 %15, %16
82  %18 = load i32, i32* %2, align 4
83  %19 = add nsw i32 %17, %18
84  %20 = load i32, i32* @func_5_xxx.static_local_3_xxx, align 4
85  %21 = add nsw i32 %19, %20
86  %22 = load i32, i32* %3, align 4
87  %23 = add nsw i32 %21, %22
88  %24 = load i32, i32* %4, align 4
89  %25 = add nsw i32 %23, %24
90  ret i32 %25
91}
92
93define i32 @varargs_func_6_xxx(i32 %arg_1_xxx, i32 %arg_2_xxx, ...) nounwind uwtable ssp {
94  %1 = alloca i32, align 4
95  %2 = alloca i32, align 4
96  store i32 %arg_1_xxx, i32* %1, align 4
97  store i32 %arg_2_xxx, i32* %2, align 4
98  ret i32 6
99}
100
101declare noalias i8* @malloc(i32)
102declare void @free(i8* nocapture)
103
104define void @dont_rename_lib_funcs() {
105; CHECK-LABEL: @foo(
106; CHECK-NEXT:  bb:
107; CHECK-NEXT:    [[TMP:%.*]] = call i8* @malloc(i32 23)
108; CHECK-NEXT:    call void @free(i8* [[TMP]])
109; CHECK-NEXT:    ret void
110;
111  %x = call i8* @malloc(i32 23)
112  call void @free(i8* %x)
113  ret void
114}
115