xref: /llvm-project/llvm/test/TableGen/GlobalISelCombinerEmitter/misc/redundant-combine-in-list.td (revision d2b74d7e4217b03e9f127505fe42410ab096afe6)
1// RUN: llvm-tblgen -I %p/../../../../include -gen-global-isel-combiner \
2// RUN:     -combiners=Combiner %s 2>&1 | FileCheck %s
3
4include "llvm/Target/Target.td"
5include "llvm/Target/GlobalISel/Combine.td"
6
7// Check we don't crash if a combine is present twice in the list.
8
9def MyTargetISA : InstrInfo;
10def MyTarget : Target { let InstructionSet = MyTargetISA; }
11
12def dummy;
13
14// CHECK: :[[@LINE+1]]:{{[0-9]+}}: warning: skipping rule 'Foo' because it has already been processed
15def Foo : GICombineRule<
16  (defs root:$root),
17  (match (G_ZEXT $root, $x)),
18  (apply (G_TRUNC $root, $x))>;
19
20def Bar : GICombineRule<
21  (defs root:$root),
22  (match (G_TRUNC $root, $x)),
23  (apply (G_ZEXT $root, $x))>;
24
25def FooBar : GICombineGroup<[ Foo, Bar ]>;
26
27def Combiner: GICombiner<"GenMyCombiner", [
28  FooBar,
29  Foo
30]>;
31