[PATCH] D85399: [StackSafety] Use `Value::stripPointerCasts` to collect lifetime marker in StackLifetime
Chuanqi Xu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 18 04:02:42 PDT 2020
ChuanqiXu updated this revision to Diff 286242.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85399/new/
https://reviews.llvm.org/D85399
Files:
llvm/test/Analysis/StackSafetyAnalysis/lifetime.ll
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<stack-lifetime><may>' -disable-output %s 2>&1 | FileCheck %s --check-prefixes=CHECK,MAY
; RUN: opt -passes='print<stack-lifetime><must>' -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: <a>
+ 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: <b>
+ 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:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85399.286242.patch
Type: text/x-patch
Size: 1959 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200818/7f541830/attachment.bin>
More information about the llvm-commits
mailing list