File: memset.ll

package info (click to toggle)
llvm-toolchain-7 1%3A7.0.1-8~deb9u3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 733,456 kB
  • sloc: cpp: 3,776,651; ansic: 633,271; asm: 350,301; python: 142,716; objc: 107,612; sh: 22,626; lisp: 11,056; perl: 7,999; pascal: 6,742; ml: 5,537; awk: 3,536; makefile: 2,557; cs: 2,027; xml: 841; ruby: 156
file content (23 lines) | stat: -rw-r--r-- 1,252 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
; RUN: opt < %s -instcombine -S | FileCheck %s

define i32 @test([1024 x i8]* %target) {
  ;; CHECK-LABEL: test
  ;; CHECK-NEXT: [[P1:%[^\s]+]] = getelementptr inbounds [1024 x i8], [1024 x i8]* %target, i64 0, i64 0
  ;; CHECK-NEXT: store i8 1, i8* [[P1]], align 1
  ;; CHECK-NEXT: [[P2:%[^\s]+]] = bitcast [1024 x i8]* %target to i16*
  ;; CHECK-NEXT: store i16 257, i16* [[P2]], align 2
  ;; CHECK-NEXT: [[P3:%[^\s]+]] = bitcast [1024 x i8]* %target to i32*
  ;; CHECK-NEXT: store i32 16843009, i32* [[P3]], align 4
  ;; CHECK-NEXT: [[P4:%[^\s]+]] = bitcast [1024 x i8]* %target to i64*
  ;; CHECK-NEXT: store i64 72340172838076673, i64* [[P4]], align 8
  ;; CHECK-NEXT: ret i32 0
  %target_p = getelementptr [1024 x i8], [1024 x i8]* %target, i32 0, i32 0
  call void @llvm.memset.p0i8.i32(i8* %target_p, i8 1, i32 0, i1 false)
  call void @llvm.memset.p0i8.i32(i8* %target_p, i8 1, i32 1, i1 false)
  call void @llvm.memset.p0i8.i32(i8* align 2 %target_p, i8 1, i32 2, i1 false)
  call void @llvm.memset.p0i8.i32(i8* align 4 %target_p, i8 1, i32 4, i1 false)
  call void @llvm.memset.p0i8.i32(i8* align 8 %target_p, i8 1, i32 8, i1 false)
  ret i32 0
}

declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i1) argmemonly nounwind