[PATCH] D85399: [NFC][StackSafety] Test that StackLifetime looks through stripPointerCasts

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 16:21:16 PDT 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf6de5306ec65: [NFC][StackSafety] Test that StackLifetime looks through stripPointerCasts (authored by ChuanqiXu, committed by vitalybuka).

Repository:
  rG LLVM Github Monorepo

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
@@ -699,6 +699,50 @@
   br label %l2
 }
 
+%struct.char_array = type { [500 x i8] }
+
+define dso_local void @gep_test(i32 %cond)  {
+; CHECK-LABEL: define dso_local void @gep_test
+entry:
+; CHECK: entry:
+; CHECK-NEXT: Alive: <>
+  %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
+; CHECK: if.then:
+; CHECK-NEXT: Alive: <>
+  %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)
+; CHECK: call void @llvm.lifetime.start.p0i8(i64 500, i8* nonnull %0)
+; CHECK-NEXT: Alive: <a>
+  tail call void @capture8(i8* %0)
+  call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %0)
+; CHECK: call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %0)
+; CHECK-NEXT: Alive: <>
+  br label %if.end
+
+if.else:                                          ; preds = %entry
+; CHECK: if.else:
+; CHECK-NEXT: Alive: <>
+  %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)
+; CHECK: call void @llvm.lifetime.start.p0i8(i64 500, i8* nonnull %1)
+; CHECK-NEXT: Alive: <b>
+  tail call void @capture8(i8* %1)
+  call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %1)
+; CHECK: call void @llvm.lifetime.end.p0i8(i64 500, i8* nonnull %1)
+; CHECK-NEXT: Alive: <>
+  br label %if.end
+
+if.end:                                           ; preds = %if.else, %if.then
+; CHECK: if.end:
+; CHECK-NEXT: Alive: <>
+  ret void
+}
+
 define void @if_must(i1 %a) {
 ; CHECK-LABEL: define void @if_must
 entry:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85399.286420.patch
Type: text/x-patch
Size: 2026 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200818/f605a916/attachment.bin>


More information about the llvm-commits mailing list