Add a pass that renames everything with metasyntatic names. This works well after...
[oota-llvm.git] / test / Transforms / MetaRenamer / metarenamer.ll
1 ; RUN: opt %s -metarenamer -S | FileCheck %s
2
3 ; CHECK: target triple {{.*}}
4 ; CHECK-NOT: {{^x*}}xxx{{^x*}}
5 ; CHECK: ret i32 6
6
7 target triple = "x86_64-pc-linux-gnu"
8
9 %struct.bar_xxx = type { i32, double }
10 %struct.foo_xxx = type { i32, float, %struct.bar_xxx }
11
12 @func_5_xxx.static_local_3_xxx = internal global i32 3, align 4
13 @global_3_xxx = common global i32 0, align 4
14
15 @func_7_xxx = alias weak i32 (...)* @aliased_func_7_xxx
16
17 declare i32 @aliased_func_7_xxx(...)
18
19 define i32 @func_3_xxx() nounwind uwtable ssp {
20   ret i32 3
21 }
22
23 define void @func_4_xxx(%struct.foo_xxx* sret %agg.result) nounwind uwtable ssp {
24   %1 = alloca %struct.foo_xxx, align 8
25   %2 = getelementptr inbounds %struct.foo_xxx* %1, i32 0, i32 0
26   store i32 1, i32* %2, align 4
27   %3 = getelementptr inbounds %struct.foo_xxx* %1, i32 0, i32 1
28   store float 2.000000e+00, float* %3, align 4
29   %4 = getelementptr inbounds %struct.foo_xxx* %1, i32 0, i32 2
30   %5 = getelementptr inbounds %struct.bar_xxx* %4, i32 0, i32 0
31   store i32 3, i32* %5, align 4
32   %6 = getelementptr inbounds %struct.bar_xxx* %4, i32 0, i32 1
33   store double 4.000000e+00, double* %6, align 8
34   %7 = bitcast %struct.foo_xxx* %agg.result to i8*
35   %8 = bitcast %struct.foo_xxx* %1 to i8*
36   call void @llvm.memcpy.p0i8.p0i8.i64(i8* %7, i8* %8, i64 24, i32 8, i1 false)
37   ret void
38 }
39
40 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
41
42 define i32 @func_5_xxx(i32 %arg_1_xxx, i32 %arg_2_xxx, i32 %arg_3_xxx, i32 %arg_4_xxx) nounwind uwtable ssp {
43   %1 = alloca i32, align 4
44   %2 = alloca i32, align 4
45   %3 = alloca i32, align 4
46   %4 = alloca i32, align 4
47   %local_1_xxx = alloca i32, align 4
48   %local_2_xxx = alloca i32, align 4
49   %i = alloca i32, align 4
50   store i32 %arg_1_xxx, i32* %1, align 4
51   store i32 %arg_2_xxx, i32* %2, align 4
52   store i32 %arg_3_xxx, i32* %3, align 4
53   store i32 %arg_4_xxx, i32* %4, align 4
54   store i32 1, i32* %local_1_xxx, align 4
55   store i32 2, i32* %local_2_xxx, align 4
56   store i32 0, i32* %i, align 4
57   br label %5
58
59 ; <label>:5                                       ; preds = %9, %0
60   %6 = load i32* %i, align 4
61   %7 = icmp slt i32 %6, 10
62   br i1 %7, label %8, label %12
63
64 ; <label>:8                                       ; preds = %5
65   br label %9
66
67 ; <label>:9                                       ; preds = %8
68   %10 = load i32* %i, align 4
69   %11 = add nsw i32 %10, 1
70   store i32 %11, i32* %i, align 4
71   br label %5
72
73 ; <label>:12                                      ; preds = %5
74   %13 = load i32* %local_1_xxx, align 4
75   %14 = load i32* %1, align 4
76   %15 = add nsw i32 %13, %14
77   %16 = load i32* %local_2_xxx, align 4
78   %17 = add nsw i32 %15, %16
79   %18 = load i32* %2, align 4
80   %19 = add nsw i32 %17, %18
81   %20 = load i32* @func_5_xxx.static_local_3_xxx, align 4
82   %21 = add nsw i32 %19, %20
83   %22 = load i32* %3, align 4
84   %23 = add nsw i32 %21, %22
85   %24 = load i32* %4, align 4
86   %25 = add nsw i32 %23, %24
87   ret i32 %25
88 }
89
90 define i32 @varargs_func_6_xxx(i32 %arg_1_xxx, i32 %arg_2_xxx, ...) nounwind uwtable ssp {
91   %1 = alloca i32, align 4
92   %2 = alloca i32, align 4
93   store i32 %arg_1_xxx, i32* %1, align 4
94   store i32 %arg_2_xxx, i32* %2, align 4
95   ret i32 6
96 }