PR4340: Run SimplifyDemandedVectorElts on insertelement instructions;
[oota-llvm.git] / lib / Transforms / Scalar / InstructionCombining.cpp
index 97bd34c771c206ed6e3ec04feb8fe4a59281709d..6d2ff0e3e53c5a5f5e7752fff595177d9f430374 100644 (file)
@@ -12579,6 +12579,12 @@ Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) {
     }
   }
 
+  unsigned VWidth = cast<VectorType>(VecOp->getType())->getNumElements();
+  APInt UndefElts(VWidth, 0);
+  APInt AllOnesEltMask(APInt::getAllOnesValue(VWidth));
+  if (SimplifyDemandedVectorElts(&IE, AllOnesEltMask, UndefElts))
+    return &IE;
+
   return 0;
 }