summaryrefslogtreecommitdiff
path: root/lib/Transforms/InstCombine
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-08-28 03:36:51 +0000
committerChris Lattner <sabre@nondot.org>2010-08-28 03:36:51 +0000
commit157d4ead36ace978a01d80a29aa1b53c832ebafb (patch)
tree40c00dc3986ea6323fbb76ed29de42236632db37 /lib/Transforms/InstCombine
parentb188a3789e2fc64ec7088a220c4c428c41d86faa (diff)
downloadllvm-157d4ead36ace978a01d80a29aa1b53c832ebafb.tar.gz
llvm-157d4ead36ace978a01d80a29aa1b53c832ebafb.tar.bz2
llvm-157d4ead36ace978a01d80a29aa1b53c832ebafb.tar.xz
for completeness, allow undef also.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112351 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine')
-rw-r--r--lib/Transforms/InstCombine/InstCombineCasts.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCasts.cpp b/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 0434d6ba0f..6c2477d52c 100644
--- a/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -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) {