[PATCH] D15718: Recognize pattern for ctpop in instcombine
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 3 07:38:40 PST 2016
kparzysz marked an inline comment as done.
================
Comment at: lib/Transforms/InstCombine/InstCombineAddSub.cpp:1158
@@ +1157,3 @@
+ unsigned TW = Ty->getBitWidth(), BW = 2*SH;
+ if (BW < TW) {
+ // BW is the bit width of the expression whose population count is
----------------
hfinkel wrote:
> Instead of checking for known zero bits, why not transform this into a ctpop(v & mask)? If the upper bits are known to be zero, then the mask will go away in the next instcombine iteration regardless.
Because then the pattern is not really computing the population count. The instructions in the pattern operate on the whole value, including the high bits, and these bits contribute to the final result.
Repository:
rL LLVM
http://reviews.llvm.org/D15718
More information about the llvm-commits
mailing list