[TableGen] Allow identical MnemonicAliases with no predicate
My use case for this is illustrated in the test case: I want to define the same instruction twice with different (disjoint) predicates, because the instruction has different operands on different subtargets. It's convenient to do this with a multiclass that also defines an alias for the instruction. Previously tablegen would complain if this alias was defined twice with no predicate. One way to fix this would be to add a predicate on each definition of the alias, matching the predicate on the instruction. But this (a) is slightly awkward to do in the real world use case I had, and (b) leads to an inefficient matcher that will do something like this: if (Mnemonic == "foo_alias") { if (Features.test(Feature_Subtarget1Bit)) Mnemonic == "foo"; else if (Features.test(Feature_Subtarget2Bit)) Mnemonic == "foo"; return; } It would be more efficient to skip the feature tests and return "foo" unconditionally. Overall it seems better to allow multiple definitions of the identical alias with no predicate. Differential Revision: https://reviews.llvm.org/D105033
Loading
Please sign in to comment