[PATCH] D29088: Do not create ctlz/cttz(X, false) when the target do not support zero defined ctlz/cttz.

Andrea Di Biagio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 10:23:28 PST 2017


andreadb added a comment.

> The branch/select is removed in InstCombine and then recreated in CodegenPrepare, effectively making it invisible to most of the optimization pipeline, which lead to bad optimizations of cttz/ctlz when the target doesn't have a zero defined version of them.

That canonicalization transform looks perfectly valid to me. It is undone in CodeGenPrepare if cttz/ctlz (with `is_zero_undef == 0`) is not supported by the target.
I don't see how it can lead to bad codegen. Could you please provide an example that shows the issue?


https://reviews.llvm.org/D29088





More information about the llvm-commits mailing list