[PATCH] D25007: [DAG] Teach computeKnownBits and ComputeNumSignBits in SelectionDAG to look through EXTRACT_VECTOR_ELT.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 2 06:50:41 PDT 2016


RKSimon added inline comments.


> mkuper wrote in SelectionDAG.cpp:2460
> 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... :-) )

FYI I looked into this when I added the BUILD_VECTOR support but was put off by the size of the refactor necessary for a full per-element result. A simpler option I've considered was to add a demanded elts argument - it still wouldn't return a per-element result but at least would be only the "lowest common denominator" of the elements we actually care about.

But anyway, just a TODO for this patch makes sense.

> mkuper wrote in SelectionDAG.cpp:2741
> 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?

ComputeNumSignBits is being used in a few places with vector types already, not sure how well its tested but the x86 SITOFP i64->FP to i32->FP transform is using it successfully.

https://reviews.llvm.org/D25007





More information about the llvm-commits mailing list