[PATCH] D145299: [InstCombine] Generate better code for std::bit_ceil
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 22 02:32:24 PDT 2023
nikic requested changes to this revision.
nikic added a comment.
This revision now requires changes to proceed.
Implementation looks fine, but this needs more test coverage.
================
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)))) {
----------------
Check `CommonAncestor == CtlzOp` here and then drop the first `if` below? So it's one MatchForward plus one MatchForward after peeking through add?
================
Comment at: llvm/test/Transforms/InstCombine/bit_ceil.ll:153
ret i32 %sel
}
----------------
Some missing tests:
* Commuted select operands.
* Select constant not 1.
* Select condition does not imply the needed range.
* Multi-use test.
* Vector test.
* Wrong constant in sub.
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