[PATCH] D24955: [ValueTracking] Teach computeKnownBits and ComputeNumSignBits to look through ExtractElement.

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 06:30:23 PDT 2016


spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D24955#555008, @bjope wrote:

> Ok, well, if Depth is about level of recursion then I agree. If it is about "search depth", then I got the feeling that it was about how many "operational" instructions that could be analysed.


Ah, I didn't think of it that way. You can ask on the dev list if you'd like a more authoritative answer. It's fuzzy to me since it's based on a magic '6' presented with no code comments. :)

LGTM - see inline for a couple of nits.


================
Comment at: test/Analysis/ValueTracking/signbits-extract-elt.ll:4
@@ +3,3 @@
+; If computeKnownBits can do a simple look-through for extractelement
+; then instsimplify will now that %elt1 is non-negative at icmp.
+define i1 @computeKnownBits_look_through_extractelt(<2 x i8> %vecin) {
----------------
typo: now -> know

================
Comment at: test/Analysis/ValueTracking/signbits-extract-elt.ll:17-20
@@ +16,6 @@
+define i32 @computeNumSignBits_look_through_extractelt(<2 x i1> %vecin) {
+; CHECK-LABEL: @computeNumSignBits_look_through_extractelt(
+; CHECK-NEXT:    %vec = sext <2 x i1> %vecin to <2 x i32>
+; CHECK-NEXT:    %elt0 = extractelement <2 x i32> %vec, i32 0
+; CHECK-NEXT:    ret i32 %elt0
+  %vec = sext <2 x i1> %vecin to <2 x i32>
----------------
A tip (mostly for future reference): you can auto-generate the CHECK lines using the script in utils/update_test_checks.py. The only difference in this case should be that the script will create FileCheck variables for you. That will provide flexibility in case the intermediate variable names change for some unrelated reason.


https://reviews.llvm.org/D24955





More information about the llvm-commits mailing list