Files
TheRock/compiler/amd-llvm/llvm/test/TableGen/GlobalISelCombinerEmitter/variadic-errors.td
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

90 lines
3.7 KiB
TableGen

// RUN: not llvm-tblgen -I %p/../../../include -gen-global-isel-combiner \
// RUN: -combiners=MyCombiner %s 2>&1| \
// RUN: FileCheck %s -implicit-check-not=error:
include "llvm/Target/Target.td"
include "llvm/Target/GlobalISel/Combine.td"
def MyTargetISA : InstrInfo;
def MyTarget : Target { let InstructionSet = MyTargetISA; }
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: 'G_BUILD_VECTOR': GIVariadic can only be used on the last operand
def VariadicNotLastInList : GICombineRule<
(defs root:$dst),
(match (G_BUILD_VECTOR $dst, $a, GIVariadic<>:$b, $c)),
(apply (G_ANYEXT $dst, $a))>;
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: 'G_IMPLICIT_DEF': GIVariadic cannot be used on defs
def VariadicAsDef : GICombineRule<
(defs root:$dst),
(match (G_IMPLICIT_DEF GIVariadic<1>:$dst)),
(apply [{ APPLY }])>;
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: conflicting types for operand 'args': 'GIVariadic<2,4>' vs 'GIVariadic<3,6>'
def ConflictingInference : GICombineRule<
(defs root:$dst),
(match (G_BUILD_VECTOR $dst, GIVariadic<2, 4>:$args)),
(apply (G_MERGE_VALUES $dst, GIVariadic<3, 6>:$args))>;
// CHECK: :[[@LINE+2]]:{{[0-9]+}}: error: cannot parse operand type: minimum number of arguments must be greater than zero in GIVariadic
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Failed to parse pattern: '(G_BUILD_VECTOR ?:$dst, anonymous_{{[0-9]+}}:$a)'
def InvalidBounds0 : GICombineRule<
(defs root:$dst),
(match (G_BUILD_VECTOR $dst, GIVariadic<0>:$a)),
(apply [{ APPLY }])>;
// CHECK: :[[@LINE+2]]:{{[0-9]+}}: error: cannot parse operand type: maximum number of arguments (1) must be zero, or greater than the minimum number of arguments (1) in GIVariadic
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Failed to parse pattern: '(G_BUILD_VECTOR ?:$dst, anonymous_{{[0-9]+}}:$a)'
def InvalidBounds1 : GICombineRule<
(defs root:$dst),
(match (G_BUILD_VECTOR $dst, GIVariadic<1,1>:$a)),
(apply [{ APPLY }])>;
// CHECK: :[[@LINE+2]]:{{[0-9]+}}: error: each instance of a GIVariadic operand must have a unique name within the match patterns
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: note: 'c' is used multiple times
def VariadicTypeTestEqOp : GICombineRule<
(defs root:$a),
(match (G_MERGE_VALUES $b, $c),
(G_BUILD_VECTOR $a, $b, GIVariadic<2, 4>:$c)),
(apply (G_MERGE_VALUES $a, $c))>;
// TODO: We could support this if needed
// CHECK: :[[@LINE+3]]:{{[0-9]+}}: error: GISpecialType is not supported in GICombinePatFrag
// CHECK: :[[@LINE+2]]:{{[0-9]+}}: note: operand 1 of '__PFWithVariadic_alt0_pattern_0' has type 'GIVariadic<1,0
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Could not parse GICombinePatFrag 'PFWithVariadic'
def PFWithVariadic: GICombinePatFrag<
(outs $dst), (ins),
[(pattern (G_ANYEXT $dst, GIVariadic<>:$b))]>;
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Failed to parse pattern: '(PFWithVariadic ?:$dst)'
def UseInPF: GICombineRule<
(defs root:$dst),
(match (PFWithVariadic $dst)),
(apply (G_ANYEXT $dst, (i32 0)))>;
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: cannot use a GIVariadic operand on non-variadic instruction 'G_MUL'
def NotVariadicInstMatch : GICombineRule<
(defs root:$a),
(match (G_MUL $a, $c, GIVariadic<2, 4>:$b)),
(apply (G_MERGE_VALUES $a, $b, $c))>;
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: cannot use a GIVariadic operand on non-variadic instruction 'G_MUL'
def NotVariadicInstApply : GICombineRule<
(defs root:$a),
(match (G_BUILD_VECTOR $a, GIVariadic<2, 4>:$b)),
(apply (G_MUL $a, $b, $c))>;
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Failed to parse one or more rules
def MyCombiner: GICombiner<"GenMyCombiner", [
VariadicNotLastInList,
VariadicAsDef,
ConflictingInference,
InvalidBounds0,
InvalidBounds1,
VariadicTypeTestEqOp,
UseInPF,
NotVariadicInstMatch,
NotVariadicInstApply
]>;