1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/FileCheck/check-dag-overlap.txt
Joel E. Denny 9cdb8f503d [FileCheck] Fix search ranges for DAG-NOT-DAG
A DAG-NOT-DAG is a CHECK-DAG group, X, followed by a CHECK-NOT group,
N, followed by a CHECK-DAG group, Y.  Let y be the initial directive
of Y.  This patch makes the following changes to the behavior:

    1. Directives in N can no longer match within part of Y's match
       range just because y happens not to be the earliest match from
       Y.  Specifically, this patch withdraws N's search range end
       from y's match range start to Y's match range start.

    2. y can no longer match within X's match range, where a y match
       produced a reordering complaint, which is thus no longer
       possible.  Specifically, this patch withdraws y's search range
       start from X's permitted range start to X's match range end,
       which was already the search range start for other members of
       Y.

Both of these changes can only increase the number of test passes: #1
constrains the ability of CHECK-NOTs to match, and #2 expands the
ability of CHECK-DAGs to match without complaints.

These changes are based on discussions at:

   <http://lists.llvm.org/pipermail/llvm-dev/2018-May/123550.html>
   <https://reviews.llvm.org/D47106>

which conclude that:

    1. These changes simplify the FileCheck conceptual model.  First,
       it makes search ranges for DAG-NOT-DAG more consistent with
       other cases.  Second, it was confusing that y was treated
       differently from the rest of Y.

    2. These changes add theoretical use cases for DAG-NOT-DAG that
       had no obvious means to be expressed otherwise.  We can justify
       the first half of this assertion with the observation that
       these changes can only increase the number of test passes.

    3. Reordering detection for DAG-NOT-DAG had no obvious real
       benefit.

We don't have evidence from real uses cases to help us debate
conclusions #2 and #3, but #1 at least seems intuitive.

Reviewed By: probinson

Differential Revision: https://reviews.llvm.org/D48986

llvm-svn: 337605
2018-07-20 20:09:56 +00:00

222 lines
7.0 KiB
Plaintext

;---------------------------------------------------------------------
; RUN: not FileCheck -allow-deprecated-dag-overlap -input-file %s %s \
; RUN: -check-prefix=IdentPat
; RUN: FileCheck -input-file %s %s -check-prefix=IdentPat
__IdentPat
add r10, r1, r2
add r11, r3, r4
mul r5, r10, r11
__IdentPat
; IdentPat: {{^}}__IdentPat
; IdentPat-DAG: {{^}}add [[REG1:r[0-9]+]], {{r[0-9]+}}, {{r[0-9]+}}
; IdentPat-DAG: {{^}}add [[REG2:r[0-9]+]], {{r[0-9]+}}, {{r[0-9]+}}
; IdentPat: {{^}}mul r5, [[REG1]], [[REG2]]
; IdentPat: {{^}}__IdentPat
;---------------------------------------------------------------------
; RUN: not FileCheck -allow-deprecated-dag-overlap -input-file %s %s \
; RUN: -check-prefix=IdentPatNot
; RUN: FileCheck -input-file %s %s -check-prefix=IdentPatNot
__IdentPatNot
add r11, r1, r2
xor r12, r1, r2
add r10, r3, r4
mul r5, r10, r11
__IdentPatNot
; IdentPatNot: {{^}}__IdentPatNot
; IdentPatNot-DAG: {{^}}add {{r[0-9]+}}, {{r[0-9]+}}, {{r[0-9]+}}
; IdentPatNot-DAG: {{^}}add {{r[0-9]+}}, {{r[0-9]+}}, {{r[0-9]+}}
; IdentPatNot-NOT: {{^}}xor
; IdentPatNot-DAG: {{^}}mul r5, r10, r11
; IdentPatNot: {{^}}__IdentPatNot
;---------------------------------------------------------------------
; RUN: FileCheck -allow-deprecated-dag-overlap -input-file %s %s \
; RUN: -check-prefix=IdentPatVarDiff
; RUN: FileCheck -input-file %s %s -check-prefix=IdentPatVarDiff
__IdentPatVarDiff
call void @foo(), !dbg !0
call void @bar(), !dbg !1
!1 = !DILocation(line: 1,
!0 = !DILocation(line: 1,
__IdentPatVarDiff
; IdentPatVarDiff: {{^}}__IdentPatVarDiff
; IdentPatVarDiff: {{^}}call void @foo(), !dbg [[DBG0:![0-9]+]]
; IdentPatVarDiff: {{^}}call void @bar(), !dbg [[DBG1:![0-9]+]]
; IdentPatVarDiff-DAG: {{^}}[[DBG0]] = !DILocation(line: 1,
; IdentPatVarDiff-DAG: {{^}}[[DBG1]] = !DILocation(line: 1,
; IdentPatVarDiff: {{^}}__IdentPatVarDiff
;---------------------------------------------------------------------
; RUN: FileCheck -allow-deprecated-dag-overlap -input-file %s %s \
; RUN: -check-prefix=IdentPatVarSame
; RUN: not FileCheck -input-file %s %s -check-prefix=IdentPatVarSame
__IdentPatVarSame
call void @foo(), !dbg !0
call void @bar(), !dbg !0
!1 = !DILocation(line: 1,
!0 = !DILocation(line: 1,
__IdentPatVarSame
; IdentPatVarSame: {{^}}__IdentPatVarSame
; IdentPatVarSame: {{^}}call void @foo(), !dbg [[DBG0:![0-9]+]]
; IdentPatVarSame: {{^}}call void @bar(), !dbg [[DBG1:![0-9]+]]
; IdentPatVarSame-DAG: {{^}}[[DBG0]] = !DILocation(line: 1,
; IdentPatVarSame-DAG: {{^}}[[DBG1]] = !DILocation(line: 1,
; IdentPatVarSame: {{^}}__IdentPatVarSame
;---------------------------------------------------------------------
; RUN: FileCheck -allow-deprecated-dag-overlap -input-file %s %s \
; RUN: -check-prefix=SupSubSet
; RUN: not FileCheck -input-file %s %s -check-prefix=SupSubSet
__SupSubSet
store i64 8, i64* %a
store i64 4, i64* %a
store i64 4, i64* %b
store i64 8, i64* %b
__SupSubSet
; SupSubSet: {{^}}__SupSubSet
; SupSubSet-DAG: {{^}}store i64 {{4|8}}, i64* %a
; SupSubSet-DAG: {{^}}store i64 4, i64* %a
; SupSubSet-DAG: {{^}}store i64 {{4|8}}, i64* %b
; SupSubSet-DAG: {{^}}store i64 4, i64* %b
; SupSubSet: {{^}}__SupSubSet
;---------------------------------------------------------------------
; RUN: FileCheck -allow-deprecated-dag-overlap -input-file %s %s \
; RUN: -check-prefix=SubSupSet
; RUN: FileCheck -input-file %s %s -check-prefix=SubSupSet
__SubSupSet
store i64 8, i64* %a
store i64 4, i64* %a
store i64 4, i64* %b
store i64 8, i64* %b
__SubSupSet
; SubSupSet: {{^}}__SubSupSet
; SubSupSet-DAG: {{^}}store i64 4, i64* %a
; SubSupSet-DAG: {{^}}store i64 {{4|8}}, i64* %a
; SubSupSet-DAG: {{^}}store i64 4, i64* %b
; SubSupSet-DAG: {{^}}store i64 {{4|8}}, i64* %b
; SubSupSet: {{^}}__SubSupSet
;---------------------------------------------------------------------
; RUN: not FileCheck -allow-deprecated-dag-overlap -input-file %s %s \
; RUN: -check-prefixes=WrongNumReps
; RUN: not FileCheck -input-file %s %s -check-prefixes=WrongNumReps
;
; RUN: not FileCheck -allow-deprecated-dag-overlap -input-file %s %s \
; RUN: -check-prefixes=WrongNumReps,WrongNumReps2
; RUN: FileCheck -input-file %s %s \
; RUN: -check-prefixes=WrongNumReps,WrongNumReps2
;
; RUN: not FileCheck -allow-deprecated-dag-overlap -input-file %s %s \
; RUN: -check-prefixes=WrongNumReps,WrongNumReps2,WrongNumReps3
; RUN: not FileCheck -input-file %s %s \
; RUN: -check-prefixes=WrongNumReps,WrongNumReps2,WrongNumReps3
__WrongNumReps
0: task_begin
1: task_begin
0: barrier_begin
1: barrier_begin
__WrongNumReps
; WrongNumReps: {{^}}__WrongNumReps
; WrongNumReps-DAG: {{^}}[[THID:[0-9]+]]: task_begin
; WrongNumReps-DAG: {{^}}[[THID]]: barrier_begin
; WrongNumReps2-DAG: {{^}}[[THID:[0-9]+]]: task_begin
; WrongNumReps2-DAG: {{^}}[[THID]]: barrier_begin
; WrongNumReps3-DAG: {{^}}[[THID:[0-9]+]]: task_begin
; WrongNumReps3-DAG: {{^}}[[THID]]: barrier_begin
; WrongNumReps-NEXT: {{^}}__WrongNumReps
;---------------------------------------------------------------------
; RUN: not FileCheck -allow-deprecated-dag-overlap -input-file %s %s \
; RUN: -check-prefix=SameSimple
; RUN: FileCheck -input-file %s %s -check-prefix=SameSimple
__SameSimple
(<foo><bar><foo>)
__SameSimple
; SameSimple: {{^}}__SameSimple
; SameSimple: {{^}}(
; SameSimple-DAG: <foo>
; SameSimple-DAG: <foo>
; SameSimple-DAG: <bar>
; SameSimple-NOT: <foo>
; SameSimple-SAME: ){{$}}
; SameSimple: {{^}}__SameSimple
;---------------------------------------------------------------------
; RUN: not FileCheck -allow-deprecated-dag-overlap -input-file %s %s \
; RUN: -check-prefix=DagNotDag
; RUN: FileCheck -input-file %s %s -check-prefix=DagNotDag
Assume we have DAGs, NOTs, DAGs, NOTs, and then DAGs. Let X, Y, and Z be
the DAG groups such that the leading DAGs are x, y, and z. y won't match
overlaps with matches from:
1. X. Otherwise, we used to get a spurious reordering complaint (back
when reordering complaints on DAG-NOT-DAG were still implemented).
2. Y, because y is in Y. To prevent these overlaps, the implementation must be
careful not to drop y's match from the previous matches list when it drops
matches from X to save search time.
3. z. This follows by applying rule #1 for z instead of y.
__DagNotDag
abcdefgh
abcd
efgh
abcd
ab
cd
abcd
cd
ab
__DagNotDag
; DagNotDag: {{^}}__DagNotDag
;
; X:
; x:DagNotDag-DAG: {{^}}abcdefgh
; DagNotDag-DAG: {{^}}abcd
; DagNotDag-DAG: efgh{{$}}
;
; Reordering complaint if rule #1 is broken.
; DagNotDag-NOT: abcd
; DagNotDag-NOT: efgh
;
; Y:
; y:DagNotDag-DAG: {{^}}abcd
; DagNotDag-DAG: {{^}}ab
; DagNotDag-DAG: cd{{$}}
;
; Matches if rule #2 is broken.
; DagNotDag-NOT: ab
; DagNotDag-NOT: cd
;
; Z:
; z:DagNotDag-DAG: {{^}}abcd
; DagNotDag-DAG: {{^}}ab
; DagNotDag-DAG: cd{{$}}
;
; Matches if rule #3 is broken.
; DagNotDag-NOT: {{^}}ab
; DagNotDag-NOT: {{^}}cd
;
; DagNotDag: {{^}}__DagNotDag