Add baseline tests for improvements of isKnownNonZero for integer types.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
llvm/test/Transforms/InstCombine/cttz.ll | ||
---|---|---|
31 ↗ | (On Diff #195958) | It would be good to also test the ctlz case here. Possibly with a vector type, so we have at least one test that checks this transform with a vector zero. |
Sorry, I didn't notice the patch stack before commenting in D60846.
LGTM - but I agree with the earlier comment about adding 1 more test for extra coverage.
Probably also a good time to request commit access, see https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access for instructions.
Will do!
llvm/test/Transforms/InstCombine/cttz.ll | ||
---|---|---|
31 ↗ | (On Diff #195958) | +1 sounds good |
llvm/test/Transforms/InstCombine/cttz.ll | ||
---|---|---|
31 ↗ | (On Diff #195958) | After looking at this, I'm not sure how this would work. The input value x would be a vector, but you can not br on a vector of i1s |
llvm/test/Transforms/InstCombine/cttz.ll | ||
---|---|---|
31 ↗ | (On Diff #195958) | That's a good point! I guess vectors are indeed not subject to this transform, at least not without additional handling (we'd have to recognize an "all elements zero" pattern for the branch condition.) In that case it might make sense to add an early exit for vector types in the main patch to avoid unnecessary walking the uses. |
llvm/test/Transforms/InstCombine/cttz.ll | ||
---|---|---|
31 ↗ | (On Diff #195958) | %t0 = bitcast <8 x i1> to i8 |
llvm/test/Transforms/InstCombine/cttz.ll | ||
---|---|---|
31 ↗ | (On Diff #195958) | @lebedev.ri Thanks! I'm not sure whether it's worthwhile to add handling for this, as it would require walking uses three levels deep (uses of the original value, uses of the bitcast, uses of the icmp). It wouldn't hurt to add a test for it though, even if it'll not be handled by this patch. |
llvm/test/Transforms/InstCombine/cttz.ll | ||
---|---|---|
31 ↗ | (On Diff #195958) |
awesome! I'll add a test with this
Good point. I'll add that |
I followed the https://llvm.org/docs/Phabricator.html#committing-a-change section for the commit. If I made a mistake, please let me know.