[PATCH] D25007: [DAG] Teach computeKnownBits and ComputeNumSignBits in SelectionDAG to look through EXTRACT_VECTOR_ELT.
Michael Kuperstein via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 2 01:42:07 PDT 2016
mkuper added inline comments.
> SelectionDAG.cpp:2460
> + }
> + computeKnownBits(Op.getOperand(0), KnownZero, KnownOne, Depth+1);
> + if (BitWidth > EltBitWidth) {
Note that this isn't as good as it could be - computeKnownBits for a vector returns the "lowest common denominator" for all vector elements. If you know, statically, which element you're looking for, you could, in theory, do better.
I don't see a clean way to do this right now, but it'd perhaps worth to have a TODO. (There's already one in the BUILD_VECTOR code... :-) )
> SelectionDAG.cpp:2741
> + if (BitWidth == EltBitWidth)
> + return ComputeNumSignBits(Op.getOperand(0), Depth+1);
> + break;
I'm a bit surprised that ComputeNumSignBits does the right thing for vectors. In fact, I have a creeping suspicion it doesn't.
Do you have a test for that specifically?
https://reviews.llvm.org/D25007
More information about the llvm-commits
mailing list