[all-commits] [llvm/llvm-project] 78623b: [GISel][TableGen] Fix accidental operand name clas...
Anatoly Trosinenko via All-commits
all-commits at lists.llvm.org
Sun Dec 10 02:25:25 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 78623b079b3be841e96ce968ae5156fe26f6c565
https://github.com/llvm/llvm-project/commit/78623b079b3be841e96ce968ae5156fe26f6c565
Author: Anatoly Trosinenko <atrosinenko at accesssoftek.com>
Date: 2023-12-10 (Sun, 10 Dec 2023)
Changed paths:
M llvm/test/TableGen/ContextlessPredicates.td
M llvm/test/TableGen/DefaultOpsGlobalISel.td
M llvm/test/TableGen/GlobalISelEmitter-input-discard.td
M llvm/test/TableGen/GlobalISelEmitter-multiple-output-discard.td
M llvm/test/TableGen/GlobalISelEmitter-multiple-output.td
M llvm/test/TableGen/GlobalISelEmitter-nested-subregs.td
M llvm/test/TableGen/GlobalISelEmitter-output-discard.td
M llvm/test/TableGen/GlobalISelEmitter-zero-reg.td
M llvm/test/TableGen/GlobalISelEmitter.td
M llvm/test/TableGen/GlobalISelEmitterCustomPredicate.td
M llvm/test/TableGen/GlobalISelEmitterHwModes.td
M llvm/test/TableGen/GlobalISelEmitterMatchTableOptimizer.td
M llvm/test/TableGen/GlobalISelEmitterMatchTableOptimizerSameOperand-invalid.td
M llvm/test/TableGen/GlobalISelEmitterRegSequence.td
M llvm/test/TableGen/GlobalISelEmitterSubreg.td
M llvm/test/TableGen/gisel-physreg-input.td
M llvm/utils/TableGen/GlobalISelEmitter.cpp
Log Message:
-----------
[GISel][TableGen] Fix accidental operand name clashes in patterns (#74492)
When importing instruction selection patterns into GlobalISel, the
operands matched in the "source" DAG are copied into corresponding
operands of the "destination" DAG according to their names (such as Rd).
If multiple operands in the source DAG share the same name, a
GIM_CheckIsSameOperand predicate makes instruction selector check the
corresponding operands for equality (at compiler run-time) as part of
matching the source pattern.
The Def operands of the root node of the destination DAG are handled
specially. The operands of the instruction corresponding to the root
node are taken and GIM_CheckRegBankForClass predicates are
tablegen-erated accordingly. If by coincidence the Def operand in
question has the same name as one of the named operands in the pattern,
a GIM_CheckIsSameOperand predicate is automatically added that is likely
to prevent matching the source of otherwise applicable selection pattern
at compiler run-time.
This patch mangles the Def operand names taken from the instruction
corresponding to the root of the destination DAG (for example, "Rd"
becomes "DstI[Rd]") preventing unexpected name clashes with pattern's
named operands.
The patch consists of three sets of changes:
* changes to the GlobalISelEmitter.cpp file are the actual fix
* a test case is added to GlobalISelEmitter.td file as a regression test
* everything else is the biggest and least interesting part - updates to
the existing test cases: renames of the form Rd -> DstI[Rd] inside the
inline comments in tablegen-erated code
More information about the All-commits
mailing list