aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/DeadStoreElimination/memintrinsics.ll
blob: e31e9fa3ca6a154c49011c95fcd0e28c46b50fa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
; RUN: opt -S -dse < %s | FileCheck %s

declare void @llvm.memcpy.i8(i8*, i8*, i8, i32)
declare void @llvm.memmove.i8(i8*, i8*, i8, i32)
declare void @llvm.memset.i8(i8*, i8, i8, i32)

define void @test1() {
; CHECK: @test1
  %A = alloca i8
  %B = alloca i8

  store i8 0, i8* %A  ;; Written to by memcpy
; CHECK-NOT: store

  call void @llvm.memcpy.i8(i8* %A, i8* %B, i8 -1, i32 0)

  ret void
; CHECK: ret void
}

define void @test2() {
; CHECK: @test2
  %A = alloca i8
  %B = alloca i8

  store i8 0, i8* %A  ;; Written to by memmove
; CHECK-NOT: store

  call void @llvm.memmove.i8(i8* %A, i8* %B, i8 -1, i32 0)

  ret void
; CHECK: ret void
}

define void @test3() {
; CHECK: @test3
  %A = alloca i8
  %B = alloca i8

  store i8 0, i8* %A  ;; Written to by memset
; CHECK-NOT: store

  call void @llvm.memset.i8(i8* %A, i8 0, i8 -1, i32 0)

  ret void
; CHECK: ret void
}