Bjorn Pettersson fed4e7d0d2 [test][MemDep] Correct the 'NOT' checks in the invalidation.ll test case. NFC
The MemoryDependenceAnalysis/invalidation.ll test case was using
  ; CHECK-NOT-AA-INVALIDATE:
but I think the intention was to use
  ; CHECK-AA-INVALIDATE-NOT:

Simply changing the checks like that would make the test fail.

The old statement that AA being stateless would result in nothing
to invalidate when doing invalidate<aa> is not true afaict.
It would be different if for example doing invalidate<basic-aa>, then
the AAManager isn't invalidated (and then neither memdep would be
invalidated). But when the AAManager itself is invalidated then we
should expect to find both "Invalidating analysis: AAManager" and
"Invalidating analysis: MemoryDependenceAnalysis" in the output.

Differential Revision: https://reviews.llvm.org/D146205
2023-03-17 09:33:16 +01:00

64 lines
2.4 KiB
LLVM

; Test that memdep gets invalidated when the analyses it depends on are
; invalidated.
;
; Check AA. AA is stateless, but given an explicit invalidate (abandon) the
; AAManager is invalidated and we must invalidate memdep as well given
; the transitive dependency.
; RUN: opt -disable-output -debug-pass-manager -aa-pipeline='basic-aa' %s 2>&1 \
; RUN: -passes='require<memdep>,invalidate<aa>,gvn' \
; RUN: | FileCheck %s --check-prefix=CHECK-AA-INVALIDATE
; CHECK-AA-INVALIDATE: Running pass: RequireAnalysisPass
; CHECK-AA-INVALIDATE: Running analysis: MemoryDependenceAnalysis
; CHECK-AA-INVALIDATE: Running pass: InvalidateAnalysisPass
; CHECK-AA-INVALIDATE: Invalidating analysis: AAManager
; CHECK-AA-INVALIDATE: Invalidating analysis: MemoryDependenceAnalysis
; CHECK-AA-INVALIDATE: Running pass: GVNPass
; CHECK-AA-INVALIDATE: Running analysis: MemoryDependenceAnalysis
;
; Check domtree specifically.
; RUN: opt -disable-output -debug-pass-manager %s 2>&1 \
; RUN: -passes='require<memdep>,invalidate<domtree>,gvn' \
; RUN: | FileCheck %s --check-prefix=CHECK-DT-INVALIDATE
; CHECK-DT-INVALIDATE: Running pass: RequireAnalysisPass
; CHECK-DT-INVALIDATE: Running analysis: MemoryDependenceAnalysis
; CHECK-DT-INVALIDATE: Running pass: InvalidateAnalysisPass
; CHECK-DT-INVALIDATE: Invalidating analysis: DominatorTreeAnalysis
; CHECK-DT-INVALIDATE: Invalidating analysis: MemoryDependenceAnalysis
; CHECK-DT-INVALIDATE: Running pass: GVNPass
; CHECK-DT-INVALIDATE: Running analysis: MemoryDependenceAnalysis
;
define void @test_use_domtree(ptr nocapture %bufUInt, ptr nocapture %pattern) nounwind {
entry:
br label %for.body
for.exit: ; preds = %for.body
ret void
for.body: ; preds = %for.body, %entry
%i.01 = phi i32 [ 0, %entry ], [ %tmp8.7, %for.body ]
%arrayidx = getelementptr i32, ptr %bufUInt, i32 %i.01
%arrayidx5 = getelementptr i32, ptr %pattern, i32 %i.01
%tmp6 = load i32, ptr %arrayidx5, align 4
store i32 %tmp6, ptr %arrayidx, align 4
%tmp8.7 = add i32 %i.01, 8
%cmp.7 = icmp ult i32 %tmp8.7, 1024
br i1 %cmp.7, label %for.body, label %for.exit
}
%t = type { i32 }
declare void @foo(ptr)
define void @test_use_aa(ptr noalias %stuff ) {
entry:
%before = load i32, ptr %stuff
call void @foo(ptr null)
%after = load i32, ptr %stuff
%sum = add i32 %before, %after
store i32 %sum, ptr %stuff
ret void
}