[llvm] r290612 - [PM] Add more dedicated testing to cover the invalidation logic added to

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 27 09:59:22 PST 2016


Author: chandlerc
Date: Tue Dec 27 11:59:22 2016
New Revision: 290612

URL: http://llvm.org/viewvc/llvm-project?rev=290612&view=rev
Log:
[PM] Add more dedicated testing to cover the invalidation logic added to
BasicAA in r290603.

I've kept the basic testing in the new PM test file as that also covers
the AAManager invalidation logic. If/when there is a good place for
broader AA testing it could move there.

This test is somewhat unsatisfying as I can't get it to fail even with
ASan outside of explicit checks of the invalidation. Apparently we don't
yet have any test coverage of the BasicAA code paths using either the
domtree or loopinfo -- I made both of them always be null and check-llvm
passed.

Added:
    llvm/trunk/test/Analysis/BasicAA/invalidation.ll

Added: llvm/trunk/test/Analysis/BasicAA/invalidation.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/invalidation.ll?rev=290612&view=auto
==============================================================================
--- llvm/trunk/test/Analysis/BasicAA/invalidation.ll (added)
+++ llvm/trunk/test/Analysis/BasicAA/invalidation.ll Tue Dec 27 11:59:22 2016
@@ -0,0 +1,47 @@
+; Test that the BasicAA analysis gets invalidated when its dependencies go
+; away.
+;
+; Check DomTree specifically.
+; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \
+; RUN:     -passes='require<aa>,invalidate<domtree>,aa-eval' -aa-pipeline='basic-aa' \
+; RUN:     | FileCheck %s --check-prefix=CHECK-DT-INVALIDATE
+; CHECK-DT-INVALIDATE: Running pass: RequireAnalysisPass
+; CHECK-DT-INVALIDATE: Running analysis: BasicAA
+; CHECK-DT-INVALIDATE: Running pass: InvalidateAnalysisPass
+; CHECK-DT-INVALIDATE: Invalidating analysis: DominatorTreeAnalysis
+; CHECK-DT-INVALIDATE: Invalidating analysis: BasicAA
+; CHECK-DT-INVALIDATE: Running pass: AAEvaluator
+; CHECK-DT-INVALIDATE: Running analysis: BasicAA
+;
+; Check LoopInfo specifically.
+; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \
+; RUN:     -passes='require<loops>,require<aa>,invalidate<loops>,aa-eval' -aa-pipeline='basic-aa' \
+; RUN:     | FileCheck %s --check-prefix=CHECK-LI-INVALIDATE
+; CHECK-LI-INVALIDATE: Running pass: RequireAnalysisPass
+; CHECK-LI-INVALIDATE: Running analysis: BasicAA
+; CHECK-LI-INVALIDATE: Running pass: InvalidateAnalysisPass
+; CHECK-LI-INVALIDATE: Invalidating analysis: LoopAnalysis
+; CHECK-LI-INVALIDATE: Invalidating analysis: BasicAA
+; CHECK-LI-INVALIDATE: Running pass: AAEvaluator
+; CHECK-LI-INVALIDATE: Running analysis: BasicAA
+
+; Some code that will result in actual AA queries, including inside of a loop.
+; FIXME: Sadly, none of these queries managed to use either the domtree or
+; loopinfo that basic-aa cache. But nor does any other test in LLVM. It would
+; be good to enhance this to actually use these other analyses to make this
+; a more thorough test.
+define void @foo(i1 %x, i8* %p1, i8* %p2) {
+entry:
+  %p3 = alloca i8
+  store i8 42, i8* %p1
+  %gep2 = getelementptr i8, i8* %p2, i32 0
+  br i1 %x, label %loop, label %exit
+
+loop:
+  store i8 13, i8* %p3
+  %tmp1 = load i8, i8* %gep2
+  br label %loop
+
+exit:
+  ret void
+}




More information about the llvm-commits mailing list