for completeness, allow undef also.
authorChris Lattner <sabre@nondot.org>
Sat, 28 Aug 2010 03:36:51 +0000 (03:36 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 28 Aug 2010 03:36:51 +0000 (03:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112351 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombineCasts.cpp

index 0434d6ba0fdc6926b8c6550e3c9ad3285c423c5e..6c2477d52c77578e8fc5313c1c3fbace31d5f838 100644 (file)
@@ -1381,6 +1381,9 @@ static unsigned getTypeSizeIndex(unsigned Value, const Type *Ty) {
 static bool CollectInsertionElements(Value *V, unsigned ElementIndex,
                                      SmallVectorImpl<Value*> &Elements,
                                      const Type *VecEltTy) {
+  // Undef values never contribute useful bits to the result.
+  if (isa<UndefValue>(V)) return true;
+  
   // If we got down to a value of the right type, we win, try inserting into the
   // right element.
   if (V->getType() == VecEltTy) {