[PATCH] D145299: [InstCombine] Generate better code for std::bit_ceil
    Kazu Hirata via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Mar 22 23:06:44 PDT 2023
    
    
  
kazu marked an inline comment as done.
kazu added a comment.
I've updated the patch.  Please take a look.  Thanks!
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:3197
+  auto MatchForward = [&](Value *CommonAncestor) {
+    const APInt *C = nullptr;
+    if (match(CtlzOp, m_Add(m_Specific(CommonAncestor), m_APInt(C)))) {
----------------
nikic wrote:
> Check `CommonAncestor == CtlzOp` here and then drop the first `if` below? So it's one MatchForward plus one MatchForward after peeking through add?
I am not sure if I understand your suggestion here.  Could you elaborate?  We have three possibilities:
- Peek through an `add`
- `MatchForward`
- Peek through an `add` and `MatchForward`
I cannot just drop the first `if` below.  I need to check for a specific operand `m_Add(m_Specific(CtlzOp), ...)`.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145299/new/
https://reviews.llvm.org/D145299
    
    
More information about the llvm-commits
mailing list