[all-commits] [llvm/llvm-project] ae3518: [GISel] Fix match tree emitter.

Kai Nacke via All-commits all-commits at lists.llvm.org
Sat Sep 17 17:04:24 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ae35188f973eb77f5fb22e55d0b8bdac0d15e89b
      https://github.com/llvm/llvm-project/commit/ae35188f973eb77f5fb22e55d0b8bdac0d15e89b
  Author: Kai Nacke <kai.peter.nacke at ibm.com>
  Date:   2022-09-18 (Sun, 18 Sep 2022)

  Changed paths:
    M llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
    M llvm/include/llvm/Target/GlobalISel/Combine.td
    M llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
    M llvm/test/TableGen/GICombinerEmitter/match-tree.td
    M llvm/utils/TableGen/GlobalISel/CodeExpansions.h
    M llvm/utils/TableGen/GlobalISel/GIMatchTree.cpp

  Log Message:
  -----------
  [GISel] Fix match tree emitter.

The following changes are necessasy to get the generated tree
matcher to compile:

- In CodeExpansions::declare(), the assert() prevents connecting
  two instructions. E.g. the match code
    (match (MUL $t, $s1, $s2),
           (SUB $d, $t, $s3)),
  results in two declarations of $t, one for the def and one for
  the use. Removing the assertion allows this construct.
  If $t is later used, it is one of the operands, which should be
  perfectly fine.
- The code emitted in GIMatchTreeVRegDefPartitioner::generatePartitionSelectorCode()
  is not compilable:
  - The value of NewInstrID should be emitted, not the name
  - Both calls involving getOperand() end with one parenthesis too many
- Swaps generated condition for the partition code in the latter function

It also changes the rules i2p_to_p2i, fabs_fabs_fold, and fneg_fneg_fold
to use the tree matcher for a linear match. These rules are tested by:

CodeGen/AArch64/GlobalISel/combine-fabs.mir
CodeGen/AArch64/GlobalISel/combine-fneg.mir
CodeGen/AArch64/GlobalISel/combine-ptrtoint.mir
CodeGen/AMDGPU/GlobalISel/combine-add-nullptr.mir

Reviewed By: arsenm

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




More information about the All-commits mailing list