[llvm] 7b27c09 - [StackSafety,NFC] Don't test terminators
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 19 02:32:29 PDT 2020
Author: Vitaly Buka
Date: 2020-06-19T02:32:17-07:00
New Revision: 7b27c09f63526ebfd974ce4e29ef3d26ef6ab686
URL: https://github.com/llvm/llvm-project/commit/7b27c09f63526ebfd974ce4e29ef3d26ef6ab686
DIFF: https://github.com/llvm/llvm-project/commit/7b27c09f63526ebfd974ce4e29ef3d26ef6ab686.diff
LOG: [StackSafety,NFC] Don't test terminators
Code does not track terminators and do not expose them through interface.
State there is just a state of the last instruction or entry.
So this information is just redundant and doesn't need to be tested.
Added:
Modified:
llvm/lib/Analysis/StackLifetime.cpp
llvm/test/Analysis/StackSafetyAnalysis/lifetime.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/StackLifetime.cpp b/llvm/lib/Analysis/StackLifetime.cpp
index 9e4df6473ede..bd225157f0aa 100644
--- a/llvm/lib/Analysis/StackLifetime.cpp
+++ b/llvm/lib/Analysis/StackLifetime.cpp
@@ -320,23 +320,12 @@ class StackLifetime::LifetimeAnnotationWriter
OS << " ; Alive: <" << llvm::join(Names, " ") << ">\n";
}
- void printBBAlive(const BasicBlock *BB, bool Start,
- formatted_raw_ostream &OS) {
+ void emitBasicBlockStartAnnot(const BasicBlock *BB,
+ formatted_raw_ostream &OS) override {
auto ItBB = SL.BlockInstRange.find(BB);
if (ItBB == SL.BlockInstRange.end())
return; // Unreachable.
- unsigned InstrNo =
- Start ? ItBB->getSecond().first : (ItBB->getSecond().second - 1);
- printInstrAlive(InstrNo, OS);
- }
-
- void emitBasicBlockStartAnnot(const BasicBlock *BB,
- formatted_raw_ostream &OS) override {
- printBBAlive(BB, true, OS);
- }
- void emitBasicBlockEndAnnot(const BasicBlock *BB,
- formatted_raw_ostream &OS) override {
- printBBAlive(BB, false, OS);
+ printInstrAlive(ItBB->getSecond().first, OS);
}
void printInfoComment(const Value &V, formatted_raw_ostream &OS) override {
diff --git a/llvm/test/Analysis/StackSafetyAnalysis/lifetime.ll b/llvm/test/Analysis/StackSafetyAnalysis/lifetime.ll
index d2ac1abdce6f..e25b3a67c9a8 100644
--- a/llvm/test/Analysis/StackSafetyAnalysis/lifetime.ll
+++ b/llvm/test/Analysis/StackSafetyAnalysis/lifetime.ll
@@ -40,8 +40,6 @@ entry:
; CHECK-NEXT: Alive: <>
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <>
}
define void @no_markers() {
@@ -63,8 +61,6 @@ entry:
call void @capture32(i32* %y)
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <y>
}
define void @g() {
@@ -106,8 +102,6 @@ entry:
; CHECK-NEXT: Alive: <>
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <>
}
define void @h() {
@@ -149,8 +143,6 @@ entry:
; CHECK-NEXT: Alive: <>
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <>
}
define void @i(i1 zeroext %a, i1 zeroext %b) {
@@ -179,8 +171,6 @@ entry:
call void @capture64(i64* nonnull %x1)
call void @capture64(i64* nonnull %x2)
br i1 %a, label %if.then, label %if.else4
-; CHECK: br i1 %a, label %if.then, label %if.else4
-; CHECK-NEXT: Alive: <x1 x2>
if.then: ; preds = %entry
; CHECK: if.then:
@@ -192,8 +182,6 @@ if.then: ; preds = %entry
call void @capture64(i64* nonnull %y)
br i1 %b, label %if.then3, label %if.else
-; CHECK: br i1 %b, label %if.then3, label %if.else
-; CHECK-NEXT: Alive: <x1 x2 y>
if.then3: ; preds = %if.then
; CHECK: if.then3:
@@ -209,8 +197,6 @@ if.then3: ; preds = %if.then
; CHECK-NEXT: Alive: <x1 x2 y>
br label %if.end
-; CHECK: br label %if.end
-; CHECK-NEXT: Alive: <x1 x2 y>
if.else: ; preds = %if.then
; CHECK: if.else:
@@ -226,8 +212,6 @@ if.else: ; preds = %if.then
; CHECK-NEXT: Alive: <x1 x2 y>
br label %if.end
-; CHECK: br label %if.end
-; CHECK-NEXT: Alive: <x1 x2 y>
if.end: ; preds = %if.else, %if.then3
; CHECK: if.end:
@@ -237,8 +221,6 @@ if.end: ; preds = %if.else, %if.then3
; CHECK-NEXT: Alive: <x1 x2>
br label %if.end9
-; CHECK: br label %if.end9
-; CHECK-NEXT: Alive: <x1 x2>
if.else4: ; preds = %entry
; CHECK: if.else4:
@@ -250,8 +232,6 @@ if.else4: ; preds = %entry
call void @capture64(i64* nonnull %z)
br i1 %b, label %if.then6, label %if.else7
-; CHECK: br i1 %b, label %if.then6, label %if.else7
-; CHECK-NEXT: Alive: <x1 x2 z>
if.then6: ; preds = %if.else4
; CHECK: if.then6:
@@ -267,8 +247,6 @@ if.then6: ; preds = %if.else4
; CHECK-NEXT: Alive: <x1 x2 z>
br label %if.end8
-; CHECK: br label %if.end8
-; CHECK-NEXT: Alive: <x1 x2 z>
if.else7: ; preds = %if.else4
; CHECK: if.else7:
@@ -284,8 +262,6 @@ if.else7: ; preds = %if.else4
; CHECK-NEXT: Alive: <x1 x2 z>
br label %if.end8
-; CHECK: br label %if.end8
-; CHECK-NEXT: Alive: <x1 x2 z>
if.end8: ; preds = %if.else7, %if.then6
; CHECK: if.end8:
@@ -295,8 +271,6 @@ if.end8: ; preds = %if.else7, %if.then6
; CHECK-NEXT: Alive: <x1 x2>
br label %if.end9
-; CHECK: br label %if.end9
-; CHECK-NEXT: Alive: <x1 x2>
if.end9: ; preds = %if.end8, %if.end
; CHECK: if.end9:
@@ -310,8 +284,6 @@ if.end9: ; preds = %if.end8, %if.end
; CHECK-NEXT: Alive: <>
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <>
}
define void @no_merge1(i1 %d) {
@@ -329,8 +301,6 @@ entry:
call void @capture32(i32* %x)
br i1 %d, label %bb2, label %bb3
-; CHECK: br i1 %d, label %bb2, label %bb3
-; CHECK-NEXT: Alive: <x>
bb2: ; preds = %entry
; CHECK: bb2:
@@ -349,8 +319,6 @@ bb2: ; preds = %entry
; CHECK-NEXT: Alive: <>
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <>
bb3: ; preds = %entry
; CHECK: bb3:
@@ -360,8 +328,6 @@ bb3: ; preds = %entry
; CHECK-NEXT: Alive: <>
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <>
}
define void @merge1(i1 %d) {
@@ -383,8 +349,6 @@ entry:
; CHECK-NEXT: Alive: <>
br i1 %d, label %bb2, label %bb3
-; CHECK: br i1 %d, label %bb2, label %bb3
-; CHECK-NEXT: Alive: <>
bb2: ; preds = %entry
; CHECK: bb2:
@@ -399,15 +363,11 @@ bb2: ; preds = %entry
; CHECK-NEXT: Alive: <>
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <>
bb3: ; preds = %entry
; CHECK: bb3:
; CHECK-NEXT: Alive: <>
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <>
}
define void @merge2_noend(i1 %d) {
@@ -429,8 +389,6 @@ entry:
; CHECK-NEXT: Alive: <>
br i1 %d, label %bb2, label %bb3
-; CHECK: br i1 %d, label %bb2, label %bb3
-; CHECK-NEXT: Alive: <>
bb2: ; preds = %entry
; CHECK: bb2:
@@ -441,15 +399,11 @@ bb2: ; preds = %entry
call void @capture32(i32* %y)
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <y>
bb3: ; preds = %entry
; CHECK: bb3:
; CHECK-NEXT: Alive: <>
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <>
}
define void @merge3_noend(i1 %d) {
@@ -467,8 +421,6 @@ entry:
call void @capture32(i32* %x)
br i1 %d, label %bb2, label %bb3
-; CHECK: br i1 %d, label %bb2, label %bb3
-; CHECK-NEXT: Alive: <x>
bb2: ; preds = %entry
; CHECK: bb2:
@@ -483,15 +435,11 @@ bb2: ; preds = %entry
call void @capture32(i32* %y)
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <y>
bb3: ; preds = %entry
; CHECK: bb3:
; CHECK-NEXT: Alive: <x>
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <x>
}
define void @nomerge4_nostart(i1 %d) {
@@ -509,8 +457,6 @@ entry:
; CHECK-NEXT: Alive: <x>
br i1 %d, label %bb2, label %bb3
-; CHECK: br i1 %d, label %bb2, label %bb3
-; CHECK-NEXT: Alive: <x>
bb2: ; preds = %entry
; CHECK: bb2:
@@ -521,15 +467,11 @@ bb2: ; preds = %entry
call void @capture32(i32* %y)
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <x y>
bb3: ; preds = %entry
; CHECK: bb3:
; CHECK-NEXT: Alive: <x>
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <x>
}
define void @array_merge() {
@@ -582,8 +524,6 @@ entry:
; CHECK-NEXT: Alive: <>
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <>
}
define void @myCall_pr15707() {
@@ -612,8 +552,6 @@ entry:
call void @capture8(i8* %buf1)
call void @capture8(i8* %buf2)
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <buf1 buf2>
}
define void @bad_range() {
@@ -646,8 +584,6 @@ entry:
; CHECK-NEXT: Alive: <A.i1 B.i2>
br label %block2
-; CHECK: br label %block2
-; CHECK-NEXT: Alive: <A.i1 B.i2>
block2: ; preds = %entry
; CHECK: block2:
@@ -655,8 +591,6 @@ block2: ; preds = %entry
call void @capture100x32([100 x i32]* %A.i)
call void @capture100x32([100 x i32]* %B.i)
ret void
-; CHECK: ret void
-; CHECK-NEXT: Alive: <A.i1 B.i2>
}
%struct.Klass = type { i32, i32 }
@@ -691,8 +625,6 @@ entry:
; CHECK-NEXT: Alive: <>
ret i32 %z3
-; CHECK: ret i32 %z3
-; CHECK-NEXT: Alive: <>
}
define void @end_loop() {
@@ -706,8 +638,6 @@ entry:
; CHECK-NEXT: Alive: <x>
br label %l2
-; CHECK: br label %l2
-; CHECK-NEXT: Alive: <x>
l2: ; preds = %l2, %entry
; CHECK: l2:
@@ -719,8 +649,6 @@ l2: ; preds = %l2, %entry
; CHECK-NEXT: Alive: <>
br label %l2
-; CHECK: br label %l2
-; CHECK-NEXT: Alive: <>
}
define void @start_loop() {
@@ -735,8 +663,6 @@ entry:
; CHECK-NEXT: Alive: <x>
br label %l2
-; CHECK: br label %l2
-; CHECK-NEXT: Alive: <x>
l2: ; preds = %l2, %entry
; CHECK: l2:
@@ -756,8 +682,6 @@ l2: ; preds = %l2, %entry
call void @capture8(i8* %x)
br label %l2
-; CHECK: br label %l2
-; CHECK-NEXT: Alive: <x>
}
define void @if_must(i1 %a) {
@@ -769,8 +693,6 @@ entry:
%y = alloca i8, align 4
br i1 %a, label %if.then, label %if.else
-; CHECK: br i1 %a
-; CHECK-NEXT: Alive: <>
if.then:
; CHECK: if.then:
@@ -780,8 +702,6 @@ if.then:
; CHECK-NEXT: Alive: <y>
br label %if.end
-; CHECK: br label %if.end
-; CHECK-NEXT: Alive: <y>
if.else:
; CHECK: if.else:
@@ -795,8 +715,6 @@ if.else:
; CHECK-NEXT: Alive: <x y>
br label %if.end
-; CHECK: br label %if.end
-; CHECK-NEXT: Alive: <x y>
if.end:
; CHECK: if.end:
@@ -804,9 +722,6 @@ if.end:
; MUST-NEXT: Alive: <y>
ret void
-; CHECK: ret void
-; MAY-NEXT: Alive: <x y>
-; MUST-NEXT: Alive: <y>
}
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
More information about the llvm-commits
mailing list