[PATCH] D53987: [ValueTracking] peek through 2-input shuffles in ComputeNumSignBits

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 2 08:05:57 PDT 2018


spatel added inline comments.


================
Comment at: lib/Analysis/ValueTracking.cpp:2526
+    Tmp = std::numeric_limits<unsigned>::max();
+    if (!isa<UndefValue>(U->getOperand(0))) {
+      Tmp = ComputeNumSignBits(U->getOperand(0), Depth + 1, Q);
----------------
RKSimon wrote:
> Don't you still have to check if a valid shuffle mask element references an UNDEF operand?
> ```
> %1 = shufflevector <4 x float> %a0, <4 x float> undef, <4 x i32> <i32 4, i32 5, i32 0, i32 1>
> ```
> Or is that guaranteed to have already been handled, the mask element set to undef and caught by containsUndefElement() ?
Yes, good catch. This is an analysis usable by any pass, so we can't assume canonical code. That means even the existing assert for 2 undefs is not allowed; it has to be a real check.


https://reviews.llvm.org/D53987





More information about the llvm-commits mailing list