[llvm] [SDPatternMatch] Make m_SetCC work like m_ICmp from IR PatternMatch. (PR #226623)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 19:08:24 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-x86

Author: Craig Topper (topperc)

<details>
<summary>Changes</summary>

The condition code is stored an operand, but we don't need to expose that to the interface.

This adds 2 signatures of m_Setcc, one that takes 2 operands and matches any condition code and one that takes the matched condition code by reference. For m_SpecificCondCode cases, I've added m_SpecificSetCC.

Similar changes have been applied to m_SelectCC and m_SelectCCLike.

Out of tree targets will need to update to the new interface. Alternatively, we could keep the current 3 operand form.

Assisted-by: Claude

---
Full diff: https://github.com/llvm/llvm-project/pull/226623.diff


8 Files Affected:

- (modified) llvm/include/llvm/CodeGen/SDPatternMatch.h (+119-49) 
- (modified) llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (+22-24) 
- (modified) llvm/lib/Target/AArch64/AArch64ISelLowering.cpp (+3-3) 
- (modified) llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp (+8-9) 
- (modified) llvm/lib/Target/RISCV/RISCVISelLowering.cpp (+8-7) 
- (modified) llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp (+7-8) 
- (modified) llvm/lib/Target/X86/X86ISelLowering.cpp (+20-22) 
- (modified) llvm/unittests/CodeGen/SelectionDAGPatternMatchTest.cpp (+72-25) 


``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````

</details>


https://github.com/llvm/llvm-project/pull/226623


More information about the llvm-commits mailing list