Index: llvm/test/Analysis/StackSafetyAnalysis/lifetime.ll =================================================================== --- llvm/test/Analysis/StackSafetyAnalysis/lifetime.ll +++ llvm/test/Analysis/StackSafetyAnalysis/lifetime.ll @@ -1,6 +1,38 @@ ; RUN: opt -passes='print' -disable-output %s 2>&1 | FileCheck %s --check-prefixes=CHECK,MAY ; RUN: opt -passes='print' -disable-output %s 2>&1 | FileCheck %s --check-prefixes=CHECK,MUST +%struct.char_array = type { [500 x i8] } + +; Function Attrs: nounwind uwtable +define dso_local void @foo(i32 %cond) local_unnamed_addr #0 { +entry: + %a = alloca %struct.char_array, align 8 + %b = alloca %struct.char_array, align 8 + %tobool.not = icmp eq i32 %cond, 0 + br i1 %tobool.not, label %if.else, label %if.then + +if.then: ; preds = %entry + %0 = getelementptr inbounds %struct.char_array, %struct.char_array* %a, i64 0, i32 0, i64 0 + call void @llvm.lifetime.start.p0i8(i64 500, i8* nonnull %0) #3 + tail call void @consume(%struct.char_array* nonnull byval(%struct.char_array) align 8 %a) #3 +; CHECK: ; Alive: + call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %0) #3 + br label %if.end + +if.else: ; preds = %entry + %1 = getelementptr inbounds %struct.char_array, %struct.char_array* %b, i64 0, i32 0, i64 0 + call void @llvm.lifetime.start.p0i8(i64 500, i8* nonnull %1) #3 + tail call void @consume(%struct.char_array* nonnull byval(%struct.char_array) align 8 %b) #3 +; CHECK: ; Alive: + call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %1) #3 + br label %if.end + +if.end: ; preds = %if.else, %if.then + ret void +} + +declare dso_local void @consume(%struct.char_array* byval(%struct.char_array) align 8) local_unnamed_addr #2 + define void @f() { ; CHECK-LABEL: define void @f() entry: