[llvm] r225936 - [dom] Add a basic dominator tree test.

Chandler Carruth chandlerc at gmail.com
Tue Jan 13 19:34:55 PST 2015


Author: chandlerc
Date: Tue Jan 13 21:34:55 2015
New Revision: 225936

URL: http://llvm.org/viewvc/llvm-project?rev=225936&view=rev
Log:
[dom] Add a basic dominator tree test.

Correct, we have *zero* basic testing of the dominator tree in the
regression test suite. There is a single test that even prints it out,
and that test only checks a single line of the output. There are
a handful of tests that check post dominators, but all of those are
looking for bugs rather than just exercising the basic machinery.

This test is super boring and unexciting. But hey, it's something.
I needed there to be something so I could switch the basic test to run
with both the old and new pass manager.

Added:
    llvm/trunk/test/Analysis/Dominators/basic.ll

Added: llvm/trunk/test/Analysis/Dominators/basic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/Dominators/basic.ll?rev=225936&view=auto
==============================================================================
--- llvm/trunk/test/Analysis/Dominators/basic.ll (added)
+++ llvm/trunk/test/Analysis/Dominators/basic.ll Tue Jan 13 21:34:55 2015
@@ -0,0 +1,57 @@
+; RUN: opt < %s -domtree -analyze | FileCheck %s
+
+define void @test1() {
+; CHECK-LABEL: 'Dominator Tree Construction' for function 'test1':
+; CHECK:      [1] %entry
+; CHECK-NEXT:   [2] %a
+; CHECK-NEXT:   [2] %c
+; CHECK-NEXT:     [3] %d
+; CHECK-NEXT:     [3] %e
+; CHECK-NEXT:   [2] %b
+
+entry:
+  br i1 undef, label %a, label %b
+
+a:
+  br label %c
+
+b:
+  br label %c
+
+c:
+  br i1 undef, label %d, label %e
+
+d:
+  ret void
+
+e:
+  ret void
+}
+
+define void @test2() {
+; CHECK-LABEL: 'Dominator Tree Construction' for function 'test2':
+; CHECK:      [1] %entry
+; CHECK-NEXT:   [2] %a
+; CHECK-NEXT:     [3] %b
+; CHECK-NEXT:       [4] %c
+; CHECK-NEXT:         [5] %d
+; CHECK-NEXT:         [5] %ret
+
+entry:
+  br label %a
+
+a:
+  br label %b
+
+b:
+  br i1 undef, label %a, label %c
+
+c:
+  br i1 undef, label %d, label %ret
+
+d:
+  br i1 undef, label %a, label %ret
+
+ret:
+  ret void
+}





More information about the llvm-commits mailing list