[PATCH] D53659: [ValueTracking] peek through shuffles in ComputeNumSignBits (PR37549)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 24 10:58:05 PDT 2018


spatel added inline comments.


================
Comment at: lib/Analysis/ValueTracking.cpp:2515
+  case Instruction::ShuffleVector:
+    // Look through shuffle of 1 source vector.
+    if (isa<UndefValue>(U->getOperand(0)))
----------------
RKSimon wrote:
> Do we know for certain that we don't reference an under operand at this point? SelectionDAG::ComputeNumSignBits bails i such cases.
I saw that, but I wasn't sure why bailing was necessary (in IR at least). 

If the shuffle's mask contains an undef, then the result for that lane is undef:
http://llvm.org/docs/LangRef.html#shufflevector-instruction

So we can choose 0 or -1 for that undef element, and so it can't reduce the number of sign bits?


https://reviews.llvm.org/D53659





More information about the llvm-commits mailing list