[llvm] 7fa8b62 - [MemorySSA] Add pointer decrement loop clobber test case.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 15 10:01:12 PST 2020
Author: Florian Hahn
Date: 2020-11-15T18:00:01Z
New Revision: 7fa8b629208c98efa883f7a0e1d51de1d21b104c
URL: https://github.com/llvm/llvm-project/commit/7fa8b629208c98efa883f7a0e1d51de1d21b104c
DIFF: https://github.com/llvm/llvm-project/commit/7fa8b629208c98efa883f7a0e1d51de1d21b104c.diff
LOG: [MemorySSA] Add pointer decrement loop clobber test case.
Added:
Modified:
llvm/test/Analysis/MemorySSA/phi-translation.ll
Removed:
################################################################################
diff --git a/llvm/test/Analysis/MemorySSA/phi-translation.ll b/llvm/test/Analysis/MemorySSA/phi-translation.ll
index 4951c022f9fb..152921325ae9 100644
--- a/llvm/test/Analysis/MemorySSA/phi-translation.ll
+++ b/llvm/test/Analysis/MemorySSA/phi-translation.ll
@@ -475,8 +475,8 @@ cleanup: ; preds = %while.body, %while.
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)
-define void @another_loop_clobber() {
-; CHECK-LABEL: void @another_loop_clobber
+define void @another_loop_clobber_inc() {
+; CHECK-LABEL: void @another_loop_clobber_inc
; CHECK-LABEL: loop.header:
; CHECK-NEXT: ; 4 = MemoryPhi({entry,1},{cond.read,3})
@@ -514,4 +514,43 @@ cleanup:
ret void
}
+define void @another_loop_clobber_dec() {
+; CHECK-LABEL: void @another_loop_clobber_dec
+; CHECK-LABEL: loop.header:
+; CHECK-NEXT: ; 4 = MemoryPhi({entry,1},{cond.read,3})
+
+; CHECK-LABEL: cond.read:
+; CHECK: ; MemoryUse(4)
+; CHECK-NEXT: %use = load i32, i32* %ptr.1, align 4
+; CHECK-NEXT: ; 2 = MemoryDef(4)
+; CHECK-NEXT: %c.2 = call i1 @cond(i32 %use)
+; CHECK-NEXT: %ptr.10 = getelementptr inbounds [12 x i32], [12 x i32]* %nodeStack, i32 0, i64 %sub
+; CHECK-NEXT: ; 3 = MemoryDef(2)
+; CHECK-NEXT: store i32 10, i32* %ptr.2, align 4
+
+entry:
+ %nodeStack = alloca [12 x i32], align 4
+ %c.1 = call i1 @cond(i32 1)
+ br i1 %c.1, label %cleanup, label %loop.header
+
+loop.header: ; preds = %entry, %while.cond.backedge
+ %depth.1 = phi i64 [ %sub, %cond.read], [ 20, %entry ]
+ %cmp = icmp sgt i64 %depth.1, 6
+ %sub = sub nsw nuw i64 %depth.1, 3
+ %sub2 = sub nsw nuw i64 %depth.1, 6
+ br i1 %cmp, label %cond.read, label %cleanup
+
+cond.read: ; preds = %while.cond
+ %ptr.1 = getelementptr inbounds [12 x i32], [12 x i32]* %nodeStack, i32 0, i64 %depth.1
+ %ptr.2 = getelementptr inbounds [12 x i32], [12 x i32]* %nodeStack, i32 0, i64 %sub2
+ %use = load i32, i32* %ptr.1, align 4
+ %c.2 = call i1 @cond(i32 %use)
+ %ptr.10 = getelementptr inbounds [12 x i32], [12 x i32]* %nodeStack, i32 0, i64 %sub
+ store i32 10, i32* %ptr.2, align 4
+ br i1 %c.2, label %loop.header, label %cleanup
+
+cleanup:
+ ret void
+}
+
declare i1 @cond(i32)
More information about the llvm-commits
mailing list