1 # RUN: llc -run-pass=ppc-merge-strings -mcpu=pwr8 -mtriple powerpc64le-unknown-linux-gnu \
2 # RUN: -verify-machineinstrs -o - %s | FileCheck %s
3 # RUN: llc -run-pass=ppc-merge-strings -mcpu=pwr8 -mtriple powerpc64-ibm-aix-xcoff \
4 # RUN: -verify-machineinstrs -o - %s | FileCheck %s
8 @.str = private unnamed_addr constant [8 x i8] c"ABCDEFG\00", align 1
9 @__const.test2.A = private unnamed_addr constant [6 x i32] [i32 34, i32 23, i32 653, i32 12, i32 75, i32 32], align 4
10 @__const.test3.A = private unnamed_addr constant [7 x float] [float 0x400AA3D700000000, float 0x4021EB8520000000, float 0x4023147AE0000000, float 0x401CEB8520000000, float 0x401C8F5C20000000, float 0x402075C280000000, float 0x3FF1C28F60000000], align 4
11 @__const.test4.A = private unnamed_addr constant [7 x double] [double 3.330000e+00, double 8.960000e+00, double 0x4023147AE147AE14, double 7.230000e+00, double 7.140000e+00, double 8.230000e+00, double 1.110000e+00], align 8
12 @.str.1 = private unnamed_addr constant [16 x i8] c"DifferentString\00", align 1
13 @__const.test5.B = private unnamed_addr constant [6 x i32] [i32 134, i32 123, i32 53, i32 142, i32 375, i32 132], align 4
14 @__const.test5.C = private unnamed_addr constant [7 x float] [float 0x4037547AE0000000, float 0x403CF5C280000000, float 0x40338A3D80000000, float 0x40313AE140000000, float 0x404111EB80000000, float 0x40323AE140000000, float 0x40263851E0000000], align 4
15 @__const.test5.D = private unnamed_addr constant [7 x double] [double 2.333000e+01, double 2.896000e+01, double 1.954000e+01, double 1.723000e+01, double 3.414000e+01, double 1.823000e+01, double 1.111000e+01], align 8
17 ; CHECK: @__ModuleStringPool = private constant { [7 x double], [7 x double], [6 x i32], [6 x i32], [7 x float], [7 x float], [8 x i8], [16 x i8] } { [7 x double] [double 3.330000e+00, double 8.960000e+00, double 0x4023147AE147AE14, double 7.230000e+00, double 7.140000e+00, double 8.230000e+00, double 1.110000e+00], [7 x double] [double 2.333000e+01, double 2.896000e+01, double 1.954000e+01, double 1.723000e+01, double 3.414000e+01, double 1.823000e+01, double 1.111000e+01], [6 x i32] [i32 34, i32 23, i32 653, i32 12, i32 75, i32 32], [6 x i32] [i32 134, i32 123, i32 53, i32 142, i32 375, i32 132], [7 x float] [float 0x400AA3D700000000, float 0x4021EB8520000000, float 0x4023147AE0000000, float 0x401CEB8520000000, float 0x401C8F5C20000000, float 0x402075C280000000, float 0x3FF1C28F60000000], [7 x float] [float 0x4037547AE0000000, float 0x403CF5C280000000, float 0x40338A3D80000000, float 0x40313AE140000000, float 0x404111EB80000000, float 0x40323AE140000000, float 0x40263851E0000000], [8 x i8] c"ABCDEFG\00", [16 x i8] c"DifferentString\00" }, align 8
19 ; List of callee functions.
20 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0
21 declare signext i32 @calleeStr(ptr noundef) local_unnamed_addr #0
22 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0
23 declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0
24 declare signext i32 @calleeInt(ptr noundef) local_unnamed_addr #0
25 declare signext i32 @calleeFloat(ptr noundef) local_unnamed_addr #0
26 declare signext i32 @calleeDouble(ptr noundef) local_unnamed_addr #0
29 ;; Start of test code.
32 define dso_local signext i32 @test1() local_unnamed_addr #0 {
34 %call = tail call signext i32 @calleeStr(ptr noundef nonnull @.str) #0
38 ; CHECK: %call = tail call signext i32 @calleeStr(ptr noundef nonnull getelementptr inbounds ({ [7 x double], [7 x double], [6 x i32], [6 x i32], [7 x float], [7 x float], [8 x i8], [16 x i8] }, ptr @__ModuleStringPool, i32 0, i32 6))
41 define dso_local signext i32 @test2() local_unnamed_addr #0 {
43 %A = alloca [6 x i32], align 4
44 call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %A) #0
45 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(24) %A, ptr noundef nonnull align 4 dereferenceable(24) @__const.test2.A, i64 24, i1 false)
46 %call = call signext i32 @calleeInt(ptr noundef nonnull %A) #0
47 call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %A) #0
51 ; CHECK: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(24) %A, ptr noundef nonnull align 4 dereferenceable(24) getelementptr inbounds ({ [7 x double], [7 x double], [6 x i32], [6 x i32], [7 x float], [7 x float], [8 x i8], [16 x i8] }, ptr @__ModuleStringPool, i32 0, i32 2), i64 24, i1 false)
52 ; CHECK: call signext i32 @calleeInt
55 define dso_local signext i32 @test3() local_unnamed_addr #0 {
57 %A = alloca [7 x float], align 4
58 call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %A) #0
59 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(28) %A, ptr noundef nonnull align 4 dereferenceable(28) @__const.test3.A, i64 28, i1 false)
60 %call = call signext i32 @calleeFloat(ptr noundef nonnull %A) #0
61 call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %A) #0
64 ; CHECK: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(28) %A, ptr noundef nonnull align 4 dereferenceable(28) getelementptr inbounds ({ [7 x double], [7 x double], [6 x i32], [6 x i32], [7 x float], [7 x float], [8 x i8], [16 x i8] }, ptr @__ModuleStringPool, i32 0, i32 4), i64 28, i1 false)
65 ; CHECK: call signext i32 @calleeFloat
68 define dso_local signext i32 @test4() local_unnamed_addr #0 {
70 %A = alloca [7 x double], align 8
71 call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %A) #0
72 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %A, ptr noundef nonnull align 8 dereferenceable(56) @__const.test4.A, i64 56, i1 false)
73 %call = call signext i32 @calleeDouble(ptr noundef nonnull %A) #0
74 call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %A) #0
77 ; CHECK: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %A, ptr noundef nonnull align 8 dereferenceable(56) @__ModuleStringPool, i64 56, i1 false)
78 ; CHECK: call signext i32 @calleeDouble
81 define dso_local signext i32 @test5() local_unnamed_addr #0 {
83 %B = alloca [6 x i32], align 4
84 %C = alloca [7 x float], align 4
85 %D = alloca [7 x double], align 8
86 call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %B) #0
87 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(24) %B, ptr noundef nonnull align 4 dereferenceable(24) @__const.test5.B, i64 24, i1 false)
88 call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %C) #0
89 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(28) %C, ptr noundef nonnull align 4 dereferenceable(28) @__const.test5.C, i64 28, i1 false)
90 call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %D) #0
91 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %D, ptr noundef nonnull align 8 dereferenceable(56) @__const.test5.D, i64 56, i1 false)
92 %call = tail call signext i32 @calleeStr(ptr noundef nonnull @.str.1) #0
93 %call1 = call signext i32 @calleeInt(ptr noundef nonnull %B) #0
94 %add = add nsw i32 %call1, %call
95 %call3 = call signext i32 @calleeFloat(ptr noundef nonnull %C) #0
96 %add4 = add nsw i32 %add, %call3
97 %call6 = call signext i32 @calleeDouble(ptr noundef nonnull %D) #0
98 %add7 = add nsw i32 %add4, %call6
99 call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %D) #0
100 call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %C) #0
101 call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %B) #0
104 ; CHECK: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(24) %B, ptr noundef nonnull align 4 dereferenceable(24) getelementptr inbounds ({ [7 x double], [7 x double], [6 x i32], [6 x i32], [7 x float], [7 x float], [8 x i8], [16 x i8] }, ptr @__ModuleStringPool, i32 0, i32 3), i64 24, i1 false)
105 ; CHECK: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(28) %C, ptr noundef nonnull align 4 dereferenceable(28) getelementptr inbounds ({ [7 x double], [7 x double], [6 x i32], [6 x i32], [7 x float], [7 x float], [8 x i8], [16 x i8] }, ptr @__ModuleStringPool, i32 0, i32 5), i64 28, i1 false)
106 ; CHECK: call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %D, ptr noundef nonnull align 8 dereferenceable(56) getelementptr inbounds ({ [7 x double], [7 x double], [6 x i32], [6 x i32], [7 x float], [7 x float], [8 x i8], [16 x i8] }, ptr @__ModuleStringPool, i32 0, i32 1), i64 56, i1 false)
107 ; CHECK: call signext i32 @calleeStr(ptr noundef nonnull getelementptr inbounds ({ [7 x double], [7 x double], [6 x i32], [6 x i32], [7 x float], [7 x float], [8 x i8], [16 x i8] }, ptr @__ModuleStringPool, i32 0, i32 7))
108 ; CHECK: call signext i32 @calleeInt
109 ; CHECK: call signext i32 @calleeFloat
110 ; CHECK: call signext i32 @calleeDouble
113 attributes #0 = { nounwind }