[PATCH] D91397: [GlobalISel] Add matchers for specific constants and a matcher for negations

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 18:02:46 PST 2020


paquette created this revision.
paquette added reviewers: aemerson, arsenm.
Herald added subscribers: kerbowa, hiraditya, rovka, nhaehnle, jvesely.
Herald added a project: LLVM.
paquette requested review of this revision.
Herald added a subscriber: wdng.

It's fairly common to need matchers for a specific constant value, or for common idioms like finding a negated register.

Add

- `m_SpecificICst`, which returns true when matching a specific value..
- `m_ZeroInt`, which returns true when an integer 0 is matched.
- `m_Neg`, which returns when a register is negated.

Also simplify the code in a few places which could use the new matchers.


https://reviews.llvm.org/D91397

Files:
  llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h
  llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
  llvm/lib/CodeGen/GlobalISel/Utils.cpp
  llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
  llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
  llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
  llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91397.305007.patch
Type: text/x-patch
Size: 8189 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201113/715f4371/attachment.bin>


More information about the llvm-commits mailing list