1; RUN: opt < %s -instcombine -S | FileCheck %s
2
3define i32 @test([1024 x i8]* %target) {
4  ;; CHECK-LABEL: test
5  ;; CHECK-NEXT: [[P1:%[^\s]+]] = getelementptr inbounds [1024 x i8], [1024 x i8]* %target, i64 0, i64 0
6  ;; CHECK-NEXT: store i8 1, i8* [[P1]], align 1
7  ;; CHECK-NEXT: [[P2:%[^\s]+]] = bitcast [1024 x i8]* %target to i16*
8  ;; CHECK-NEXT: store i16 257, i16* [[P2]], align 2
9  ;; CHECK-NEXT: [[P3:%[^\s]+]] = bitcast [1024 x i8]* %target to i32*
10  ;; CHECK-NEXT: store i32 16843009, i32* [[P3]], align 4
11  ;; CHECK-NEXT: [[P4:%[^\s]+]] = bitcast [1024 x i8]* %target to i64*
12  ;; CHECK-NEXT: store i64 72340172838076673, i64* [[P4]], align 8
13  ;; CHECK-NEXT: ret i32 0
14  %target_p = getelementptr [1024 x i8], [1024 x i8]* %target, i32 0, i32 0
15  call void @llvm.memset.p0i8.i32(i8* %target_p, i8 1, i32 0, i1 false)
16  call void @llvm.memset.p0i8.i32(i8* %target_p, i8 1, i32 1, i1 false)
17  call void @llvm.memset.p0i8.i32(i8* align 2 %target_p, i8 1, i32 2, i1 false)
18  call void @llvm.memset.p0i8.i32(i8* align 4 %target_p, i8 1, i32 4, i1 false)
19  call void @llvm.memset.p0i8.i32(i8* align 8 %target_p, i8 1, i32 8, i1 false)
20  ret i32 0
21}
22
23declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i1) argmemonly nounwind
24