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

Unified Diff: tests_lit/llvm2ice_tests/licm.ll

Issue 2138443002: Subzero: Loop Invariant Code Motion (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Address comments Created 4 years, 5 months 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/IceTimerTree.def ('k') | tests_lit/llvm2ice_tests/loop-nest-depth.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/llvm2ice_tests/licm.ll
diff --git a/tests_lit/llvm2ice_tests/licm.ll b/tests_lit/llvm2ice_tests/licm.ll
new file mode 100644
index 0000000000000000000000000000000000000000..53761bb36ce90ec618572378670d4a0cfb44e3ca
--- /dev/null
+++ b/tests_lit/llvm2ice_tests/licm.ll
@@ -0,0 +1,36 @@
+; Tests if the licm flag successfully hoists the add from loop0 to entry
+
+; RUN: %p2i -i %s --filetype=obj --disassemble --target x8664 --args \
+; RUN: -O2 -licm | FileCheck --check-prefix ENABLE %s
+
+; RUN: %p2i -i %s --filetype=obj --disassemble --target x8664 --args \
+; RUN: -O2 | FileCheck --check-prefix NOENABLE %s
+
+define internal void @dummy() {
+entry:
+ ret void
+}
+define internal i32 @test_licm(i32 %a32, i32 %b, i32 %c) {
+entry:
+ %a = trunc i32 %a32 to i1
+ br label %loop0
+loop0: ; <-+
+ call void @dummy() ; |
+ %add1 = add i32 %b, %c ; |
+ br label %loop1 ; |
+loop1: ; |
+ br i1 %a, label %loop0, label %out ; --+
+out:
+ ret i32 %add1
+}
+
+; CHECK-LABEL: test_licm
+
+; ENABLE: add
+; ENABLE: call
+
+; NOENABLE: call
+; NOENABLE-NEXT: mov
+; NOENABLE-NEXT: add
+
+; CHECK: ret
« no previous file with comments | « src/IceTimerTree.def ('k') | tests_lit/llvm2ice_tests/loop-nest-depth.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698