brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 3d74c84 Raw
41 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -S -passes=dse < %s | FileCheck %s3 4target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"5 6declare void @llvm.lifetime.start.p0(ptr nocapture) nounwind7declare void @llvm.lifetime.end.p0(ptr nocapture) nounwind8declare void @llvm.memset.p0.i8(ptr nocapture, i8, i8, i1) nounwind9 10define void @test1() {11; CHECK-LABEL: @test1(12; CHECK-NEXT:    [[A:%.*]] = alloca i8, align 113; CHECK-NEXT:    call void @llvm.lifetime.end.p0(ptr [[A]])14; CHECK-NEXT:    ret void15;16  %A = alloca i817 18  store i8 0, ptr %A  ;; Written to by memset19  call void @llvm.lifetime.end.p0(ptr %A)20 21  call void @llvm.memset.p0.i8(ptr %A, i8 0, i8 -1, i1 false)22 23  ret void24}25 26define void @test2(ptr %P) {27; CHECK-LABEL: @test2(28; CHECK-NEXT:    [[Q:%.*]] = alloca i32, align 429; CHECK-NEXT:    call void @llvm.lifetime.start.p0(ptr [[Q]])30; CHECK-NEXT:    call void @llvm.lifetime.end.p0(ptr [[Q]])31; CHECK-NEXT:    ret void32;33  %Q = alloca i3234  call void @llvm.lifetime.start.p0(ptr %Q)35  store i32 0, ptr %Q  ;; This store is dead.36  call void @llvm.lifetime.end.p0(ptr %Q)37  ret void38}39 40declare void @use(ptr) readonly41