1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -mtriple=x86_64-apple-macosx10.7 -passes=inferattrs,dse -S %s | FileCheck %s
4 ; Tests for libcalls only available on Darwin platforms.
6 declare void @memset_pattern4(ptr, ptr, i64)
7 declare void @memset_pattern8(ptr, ptr, i64)
8 declare void @memset_pattern16(ptr, ptr, i64)
10 define void @test_memset_pattern4_const_size(ptr noalias %a, ptr noalias %pattern) {
11 ; CHECK-LABEL: @test_memset_pattern4_const_size(
13 ; CHECK-NEXT: [[A_GEP_17:%.*]] = getelementptr i8, ptr [[A:%.*]], i32 17
14 ; CHECK-NEXT: store i8 1, ptr [[A_GEP_17]], align 1
15 ; CHECK-NEXT: call void @memset_pattern4(ptr [[A]], ptr [[PATTERN:%.*]], i64 17)
16 ; CHECK-NEXT: ret void
19 %a.gep.1 = getelementptr i8, ptr %a, i32 1
20 store i8 0, ptr %a.gep.1
21 %a.gep.17 = getelementptr i8, ptr %a, i32 17
22 store i8 1, ptr %a.gep.17
23 call void @memset_pattern4(ptr %a, ptr %pattern, i64 17)
27 define void @test_memset_pattern4_variable_size(ptr noalias %a, ptr noalias %pattern, i64 %n) {
28 ; CHECK-LABEL: @test_memset_pattern4_variable_size(
30 ; CHECK-NEXT: [[A_GEP_1:%.*]] = getelementptr i8, ptr [[A:%.*]], i32 1
31 ; CHECK-NEXT: store i8 0, ptr [[A_GEP_1]], align 1
32 ; CHECK-NEXT: [[A_GEP_17:%.*]] = getelementptr i8, ptr [[A]], i32 17
33 ; CHECK-NEXT: store i8 1, ptr [[A_GEP_17]], align 1
34 ; CHECK-NEXT: call void @memset_pattern4(ptr [[A]], ptr [[PATTERN:%.*]], i64 [[N:%.*]])
35 ; CHECK-NEXT: ret void
38 %a.gep.1 = getelementptr i8, ptr %a, i32 1
39 store i8 0, ptr %a.gep.1
40 %a.gep.17 = getelementptr i8, ptr %a, i32 17
41 store i8 1, ptr %a.gep.17
42 call void @memset_pattern4(ptr %a, ptr %pattern, i64 %n)
46 define void @test_memset_pattern8_const_size(ptr noalias %a, ptr noalias %pattern) {
47 ; CHECK-LABEL: @test_memset_pattern8_const_size(
49 ; CHECK-NEXT: [[A_GEP_17:%.*]] = getelementptr i8, ptr [[A:%.*]], i32 17
50 ; CHECK-NEXT: store i8 1, ptr [[A_GEP_17]], align 1
51 ; CHECK-NEXT: call void @memset_pattern8(ptr [[A]], ptr [[PATTERN:%.*]], i64 17)
52 ; CHECK-NEXT: ret void
55 %a.gep.1 = getelementptr i8, ptr %a, i32 1
56 store i8 0, ptr %a.gep.1
57 %a.gep.17 = getelementptr i8, ptr %a, i32 17
58 store i8 1, ptr %a.gep.17
59 call void @memset_pattern8(ptr %a, ptr %pattern, i64 17)
63 define void @test_memset_pattern8_variable_size(ptr noalias %a, ptr noalias %pattern, i64 %n) {
64 ; CHECK-LABEL: @test_memset_pattern8_variable_size(
66 ; CHECK-NEXT: [[A_GEP_1:%.*]] = getelementptr i8, ptr [[A:%.*]], i32 1
67 ; CHECK-NEXT: store i8 0, ptr [[A_GEP_1]], align 1
68 ; CHECK-NEXT: [[A_GEP_17:%.*]] = getelementptr i8, ptr [[A]], i32 17
69 ; CHECK-NEXT: store i8 1, ptr [[A_GEP_17]], align 1
70 ; CHECK-NEXT: call void @memset_pattern8(ptr [[A]], ptr [[PATTERN:%.*]], i64 [[N:%.*]])
71 ; CHECK-NEXT: ret void
74 %a.gep.1 = getelementptr i8, ptr %a, i32 1
75 store i8 0, ptr %a.gep.1
76 %a.gep.17 = getelementptr i8, ptr %a, i32 17
77 store i8 1, ptr %a.gep.17
78 call void @memset_pattern8(ptr %a, ptr %pattern, i64 %n)
82 define void @test_memset_pattern16_const_size(ptr noalias %a, ptr noalias %pattern) {
83 ; CHECK-LABEL: @test_memset_pattern16_const_size(
85 ; CHECK-NEXT: [[A_GEP_17:%.*]] = getelementptr i8, ptr [[A:%.*]], i32 17
86 ; CHECK-NEXT: store i8 1, ptr [[A_GEP_17]], align 1
87 ; CHECK-NEXT: call void @memset_pattern16(ptr [[A]], ptr [[PATTERN:%.*]], i64 17)
88 ; CHECK-NEXT: ret void
91 %a.gep.1 = getelementptr i8, ptr %a, i32 1
92 store i8 0, ptr %a.gep.1
93 %a.gep.17 = getelementptr i8, ptr %a, i32 17
94 store i8 1, ptr %a.gep.17
95 call void @memset_pattern16(ptr %a, ptr %pattern, i64 17)
99 define void @test_memset_pattern16_variable_size(ptr noalias %a, ptr noalias %pattern, i64 %n) {
100 ; CHECK-LABEL: @test_memset_pattern16_variable_size(
102 ; CHECK-NEXT: [[A_GEP_1:%.*]] = getelementptr i8, ptr [[A:%.*]], i32 1
103 ; CHECK-NEXT: store i8 0, ptr [[A_GEP_1]], align 1
104 ; CHECK-NEXT: [[A_GEP_17:%.*]] = getelementptr i8, ptr [[A]], i32 17
105 ; CHECK-NEXT: store i8 1, ptr [[A_GEP_17]], align 1
106 ; CHECK-NEXT: call void @memset_pattern16(ptr [[A]], ptr [[PATTERN:%.*]], i64 [[N:%.*]])
107 ; CHECK-NEXT: ret void
110 %a.gep.1 = getelementptr i8, ptr %a, i32 1
111 store i8 0, ptr %a.gep.1
112 %a.gep.17 = getelementptr i8, ptr %a, i32 17
113 store i8 1, ptr %a.gep.17
114 call void @memset_pattern16(ptr %a, ptr %pattern, i64 %n)