[PATCH] D133257: [GISel] Fix match tree emitter.
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 16 15:52:05 PDT 2022
arsenm added inline comments.
================
Comment at: llvm/utils/TableGen/GlobalISel/CodeExpansions.h:27-28
void declare(StringRef Name, StringRef Expansion) {
- bool Inserted = Expansions.try_emplace(Name, Expansion).second;
- assert(Inserted && "Declared variable twice");
- (void)Inserted;
+ // Duplicates are not inserted. The expansion refers to different operands
+ // but to the same virtual register.
+ Expansions.try_emplace(Name, Expansion);
----------------
Kai wrote:
> arsenm wrote:
> > Comment doesn't read right. Maybe you meant "refers not to different operands"?
> What I am trying to describe: Consider
>
> ```
> (match (MUL $t, $s1, $s2),
> (SUB $d, $t, $s3)),
>
> ```
> the variable `$t` appears twice in the pattern, and `declare()` is called twice.
>
> - One replacement is `MIs[0]->getOperand(1)`, that is, the use in the SUB instruction
> - The other replacement is `MIs[1]->getOperand(0)`, the definition in the MUL instruction
>
> Thus the operands are different (even of different instructions), but both refer to the same virtual register.
>
How about
> Duplicates are not inserted. The expansion refers to different MachineOperands using the same virtual register
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133257/new/
https://reviews.llvm.org/D133257
More information about the llvm-commits
mailing list