Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(675)

Unified Diff: tests_lit/llvm2ice_tests/loop-nest-depth.ll

Issue 1416113007: Subzero: Recognize single-block loops during loop depth analysis. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceLoopAnalyzer.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/llvm2ice_tests/loop-nest-depth.ll
diff --git a/tests_lit/llvm2ice_tests/loop-nest-depth.ll b/tests_lit/llvm2ice_tests/loop-nest-depth.ll
index 8baf4350a32d6d05ff9aea21efac36d1db772ec3..a899e50c0f263dbaf43d7f5f7b9a9ea8c512adca 100644
--- a/tests_lit/llvm2ice_tests/loop-nest-depth.ll
+++ b/tests_lit/llvm2ice_tests/loop-nest-depth.ll
@@ -279,3 +279,28 @@ out:
; CHECK-NEXT: out:
; CHECK-NEXT: LoopNestDepth = 0
; CHECK-LABEL: Before RMW
+
+define internal void @test_single_block_loop(i32 %count) {
+entry:
+ br label %body
+body:
+; %i = phi i32 [ 0, %entry ], [ %inc, %body ]
+; A normal loop would have a phi instruction like above for the induction
+; variable, but that may introduce new basic blocks due to phi edge splitting,
+; so we use an alternative definition for %i to make the test more clear.
+ %i = add i32 %count, 1
+ %inc = add i32 %i, 1
+ %cmp = icmp slt i32 %inc, %count
+ br i1 %cmp, label %body, label %exit
+exit:
+ ret void
+}
+
+; CHECK-LABEL: After loop nest depth analysis
+; CHECK-NEXT: entry:
+; CHECK-NEXT: LoopNestDepth = 0
+; CHECK-NEXT: body:
+; CHECK-NEXT: LoopNestDepth = 1
+; CHECK-NEXT: exit:
+; CHECK-NEXT: LoopNestDepth = 0
+; CHECK-LABEL: Before RMW
« no previous file with comments | « src/IceLoopAnalyzer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698