[PATCH] D103788: [InstCombine] Eliminate casts to optimize ctlz operation
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 9 09:31:48 PDT 2021
lebedev.ri requested changes to this revision.
lebedev.ri added a comment.
This revision now requires changes to proceed.
I think this is being approached from the wrong angle.
You currently transform `trunc (ctlz(zext(A))) --> add(ctlz(A), (bitwidth(zext(A))-bitwidth(A))`,
but why does that `trunc` matter?
Wouldn't it make more sense to view this as `ctlz(zext(A)) --> add(ctlz(A), (bitwidth(zext(A))-bitwidth(A))`?
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:954
+ // trunc (ctlz_i32(zext(A), B) --> add(ctlz_i16(A, B), C)
+ if (match(Src, m_OneUse(m_Intrinsic<Intrinsic::ctlz>(
+ m_OneUse(m_ZExt(m_Value(A))), m_Value(B))))) {
----------------
Are you not missing a check that types of `A` and `Trunc` match?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103788/new/
https://reviews.llvm.org/D103788
More information about the llvm-commits
mailing list