mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
c38d6febb5
BasicAA stores a reference to LoopInfo inside. This imposes an implicit requirement of keeping it up to date whenever we modify the IR (in particular, whenever we modify terminators of blocks that belong to loops). Failing to do so leads to incorrect state of the LoopInfo. Because general AA does not require loop info updates and provides to API to update it properly, the users of AA reasonably assume that there is no need to update the loop info. It may be a reason of bugs, as example in PR43276 shows. This patch drops dependence of BasicAA on LoopInfo to avoid this problem. This may potentially pessimize the result of queries to BasicAA. Differential Revision: https://reviews.llvm.org/D98627 Reviewed By: nikic
48 lines
1.9 KiB
LLVM
48 lines
1.9 KiB
LLVM
; 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 PhiValues specifically.
|
|
; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \
|
|
; RUN: -passes='require<phi-values>,require<aa>,invalidate<phi-values>,aa-eval' -aa-pipeline='basic-aa' \
|
|
; RUN: | FileCheck %s --check-prefix=CHECK-PV-INVALIDATE
|
|
; CHECK-PV-INVALIDATE: Running pass: RequireAnalysisPass
|
|
; CHECK-PV-INVALIDATE: Running analysis: BasicAA
|
|
; CHECK-PV-INVALIDATE: Running pass: InvalidateAnalysisPass
|
|
; CHECK-PV-INVALIDATE: Invalidating analysis: PhiValuesAnalysis
|
|
; CHECK-PV-INVALIDATE: Invalidating analysis: BasicAA
|
|
; CHECK-PV-INVALIDATE: Running pass: AAEvaluator
|
|
; CHECK-PV-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
|
|
}
|