[all-commits] [llvm/llvm-project] 6082a0: [GlobalISel] Match table opt: fix a bug in matchin...

Roman Tereshin via All-commits all-commits at lists.llvm.org
Fri Nov 1 02:43:12 PDT 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6082a062a76d0bc9c9c641f5600569bafdf4c338
      https://github.com/llvm/llvm-project/commit/6082a062a76d0bc9c9c641f5600569bafdf4c338
  Author: Roman Tereshin <rtereshin at apple.com>
  Date:   2019-11-01 (Fri, 01 Nov 2019)

  Changed paths:
    A llvm/test/TableGen/GlobalISelEmitterVariadic.td
    M llvm/utils/TableGen/GlobalISelEmitter.cpp

  Log Message:
  -----------
  [GlobalISel] Match table opt: fix a bug in matching num of operands

If there is a dag node with a variable number of operands that has at
least N operands (for some non-negative N), and multiple patterns with
that node with different number of operands, we would drop the number of
operands check in patterns with N operands, presumably because it's
guaranteed in such case that none of the per-operand checks will access
the operand list out-of-bounds.

Except semantically the check is about having exactly N operands, not at
least N operands, and a backend might rely on it to disambiguate
different patterns.

In this patch we change the condition on emitting the number of operands
check from "the instruction is not guaranteed to have at least as many
operands as are checked by the pattern being matched" to "the
instruction is not guaranteed to have a specific number of operands".

We're relying (still) on the rest of the CodeGenPatterns mechanics to
validate that the pattern itself doesn't try to access more operands
than there is in the instruction in cases when the instruction does have
fixed number of operands, and on the machine verifier to validate at
runtime that particular MIs like that satisfy the constraint as well.

Reviewers: dsanders, qcolombet

Reviewed By: qcolombet

Subscribers: arsenm, rovka, Petar.Avramovic, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D69653




More information about the All-commits mailing list