brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 7293228 Raw
46 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --prefix-filecheck-ir-name abc2; RUN: opt -passes=dse -S < %s | FileCheck %s3 4; Make sure invokes are not removed as dead stores.5define void @test_nounwind_invoke() personality ptr @__gxx_personality_v0 {6; CHECK-LABEL: @test_nounwind_invoke(7; CHECK-NEXT:  bb:8; CHECK-NEXT:    [[TMP:%.*]] = alloca i32, align 49; CHECK-NEXT:    invoke void @foo(ptr [[TMP]])10; CHECK-NEXT:    to label [[BB1:%.*]] unwind label [[BB2:%.*]]11; CHECK:       bb1:12; CHECK-NEXT:    call void @llvm.lifetime.end.p0(ptr [[TMP]])13; CHECK-NEXT:    ret void14; CHECK:       bb2:15; CHECK-NEXT:    [[ABCTMP1:%.*]] = landingpad { ptr, i32 }16; CHECK-NEXT:    cleanup17; CHECK-NEXT:    resume { ptr, i32 } [[ABCTMP1]]18;19bb:20  %tmp = alloca i32, align 421  ; 'foo' is 'argmemonly', meaning it can only write to memory pointed by %tmp.22  ; And this def is killed by 'call @llvm.lifetime.end.p0' in bb1 without23  ; being used elsewhere, becoming a dead store. But we shouldn't remove this24  ; because invokes are terminators and thus cannot be removed.25  invoke void @foo(ptr %tmp)26  to label %bb1 unwind label %bb227 28bb1:                                              ; preds = %bb29  call void @llvm.lifetime.end.p0(ptr %tmp)30  ret void31 32bb2:                                              ; preds = %bb33  %tmp1 = landingpad { ptr, i32 }34  cleanup35  resume { ptr, i32 } %tmp136}37 38; Function Attrs: argmemonly nocallback nofree nosync nounwind willreturn39declare void @llvm.lifetime.end.p0(ptr nocapture) #040; Function Attrs: argmemonly nounwind willreturn41declare void @foo(ptr) #142declare i32 @__gxx_personality_v0(...)43 44attributes #0 = { argmemonly nocallback nofree nosync nounwind willreturn }45attributes #1 = { argmemonly nounwind willreturn }46