1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2 ; RUN: opt -mtriple=x86_64-pc-linux-gnu -passes=pre-isel-intrinsic-lowering -S -o - %s | FileCheck %s
4 ; Constant length memset.inline should be left unmodified.
5 define void @memset_32(ptr %a, i8 %value) nounwind {
6 ; CHECK-LABEL: define void @memset_32(
7 ; CHECK-SAME: ptr [[A:%.*]], i8 [[VALUE:%.*]]) #[[ATTR0:[0-9]+]] {
8 ; CHECK-NEXT: call void @llvm.memset.inline.p0.i64(ptr [[A]], i8 [[VALUE]], i64 32, i1 false)
9 ; CHECK-NEXT: tail call void @llvm.memset.inline.p0.i64(ptr [[A]], i8 [[VALUE]], i64 32, i1 true)
10 ; CHECK-NEXT: ret void
12 call void @llvm.memset.inline.p0.i64(ptr %a, i8 %value, i64 32, i1 0)
13 tail call void @llvm.memset.inline.p0.i64(ptr %a, i8 %value, i64 32, i1 1)
17 define void @memset_x(ptr %a, i8 %value, i64 %x) nounwind {
18 ; CHECK-LABEL: define void @memset_x(
19 ; CHECK-SAME: ptr [[A:%.*]], i8 [[VALUE:%.*]], i64 [[X:%.*]]) #[[ATTR0]] {
20 ; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i64 0, [[X]]
21 ; CHECK-NEXT: br i1 [[TMP1]], label %[[SPLIT:.*]], label %[[LOADSTORELOOP:.*]]
22 ; CHECK: [[LOADSTORELOOP]]:
23 ; CHECK-NEXT: [[TMP2:%.*]] = phi i64 [ 0, [[TMP0:%.*]] ], [ [[TMP4:%.*]], %[[LOADSTORELOOP]] ]
24 ; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 [[TMP2]]
25 ; CHECK-NEXT: store i8 [[VALUE]], ptr [[TMP3]], align 1
26 ; CHECK-NEXT: [[TMP4]] = add i64 [[TMP2]], 1
27 ; CHECK-NEXT: [[TMP5:%.*]] = icmp ult i64 [[TMP4]], [[X]]
28 ; CHECK-NEXT: br i1 [[TMP5]], label %[[LOADSTORELOOP]], label %[[SPLIT]]
30 ; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i64 0, [[X]]
31 ; CHECK-NEXT: br i1 [[TMP6]], label %[[SPLIT1:.*]], label %[[LOADSTORELOOP2:.*]]
32 ; CHECK: [[LOADSTORELOOP2]]:
33 ; CHECK-NEXT: [[TMP7:%.*]] = phi i64 [ 0, %[[SPLIT]] ], [ [[TMP9:%.*]], %[[LOADSTORELOOP2]] ]
34 ; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 [[TMP7]]
35 ; CHECK-NEXT: store volatile i8 [[VALUE]], ptr [[TMP8]], align 1
36 ; CHECK-NEXT: [[TMP9]] = add i64 [[TMP7]], 1
37 ; CHECK-NEXT: [[TMP10:%.*]] = icmp ult i64 [[TMP9]], [[X]]
38 ; CHECK-NEXT: br i1 [[TMP10]], label %[[LOADSTORELOOP2]], label %[[SPLIT1]]
40 ; CHECK-NEXT: ret void
42 call void @llvm.memset.inline.p0.i64(ptr %a, i8 %value, i64 %x, i1 0)
43 tail call void @llvm.memset.inline.p0.i64(ptr %a, i8 %value, i64 %x, i1 1)