Home | History | Annotate | Download | only in DeadStoreElimination
      1 ; RUN: opt -S -dse < %s | FileCheck %s
      2 
      3 declare void @llvm.memcpy.p0i8.p0i8.i8(i8* nocapture, i8* nocapture, i8, i32, i1) nounwind
      4 declare void @llvm.memmove.p0i8.p0i8.i8(i8* nocapture, i8* nocapture, i8, i32, i1) nounwind
      5 declare void @llvm.memset.p0i8.i8(i8* nocapture, i8, i8, i32, i1) nounwind
      6 
      7 define void @test1() {
      8 ; CHECK: @test1
      9   %A = alloca i8
     10   %B = alloca i8
     11 
     12   store i8 0, i8* %A  ;; Written to by memcpy
     13 ; CHECK-NOT: store
     14 
     15   call void @llvm.memcpy.p0i8.p0i8.i8(i8* %A, i8* %B, i8 -1, i32 0, i1 false)
     16 
     17   ret void
     18 ; CHECK: ret void
     19 }
     20 
     21 define void @test2() {
     22 ; CHECK: @test2
     23   %A = alloca i8
     24   %B = alloca i8
     25 
     26   store i8 0, i8* %A  ;; Written to by memmove
     27 ; CHECK-NOT: store
     28 
     29   call void @llvm.memmove.p0i8.p0i8.i8(i8* %A, i8* %B, i8 -1, i32 0, i1 false)
     30 
     31   ret void
     32 ; CHECK: ret void
     33 }
     34 
     35 define void @test3() {
     36 ; CHECK: @test3
     37   %A = alloca i8
     38   %B = alloca i8
     39 
     40   store i8 0, i8* %A  ;; Written to by memset
     41 ; CHECK-NOT: store
     42 
     43   call void @llvm.memset.p0i8.i8(i8* %A, i8 0, i8 -1, i32 0, i1 false)
     44 
     45   ret void
     46 ; CHECK: ret void
     47 }
     48