Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.471 -> 1.472 --- Log message: Add support for inserting undef into a vector. This implements Transforms/InstCombine/vec_insert_to_shuffle.ll --- Diffs of the changes: (+14 -3) InstructionCombining.cpp | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.471 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.472 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.471 Thu Apr 20 10:41:37 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Apr 27 16:14:21 2006 @@ -6959,12 +6959,23 @@ Value *ScalarOp = IEI->getOperand(1); Value *IdxOp = IEI->getOperand(2); - if (ExtractElementInst *EI = dyn_cast<ExtractElementInst>(ScalarOp)) { - if (isa<ConstantInt>(EI->getOperand(1)) && isa<ConstantInt>(IdxOp) && + if (!isa<ConstantInt>(IdxOp)) + return false; + unsigned InsertedIdx = cast<ConstantInt>(IdxOp)->getRawValue(); + + if (isa<UndefValue>(ScalarOp)) { // inserting undef into vector. + // Okay, we can handle this if the vector we are insertinting into is + // transitively ok. + if (CollectSingleShuffleElements(VecOp, LHS, RHS, Mask)) { + // If so, update the mask to reflect the inserted undef. + Mask[InsertedIdx] = UndefValue::get(Type::UIntTy); + return true; + } + } else if (ExtractElementInst *EI = dyn_cast<ExtractElementInst>(ScalarOp)){ + if (isa<ConstantInt>(EI->getOperand(1)) && EI->getOperand(0)->getType() == V->getType()) { unsigned ExtractedIdx = cast<ConstantInt>(EI->getOperand(1))->getRawValue(); - unsigned InsertedIdx = cast<ConstantInt>(IdxOp)->getRawValue(); // This must be extracting from either LHS or RHS. if (EI->getOperand(0) == LHS || EI->getOperand(0) == RHS) { _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits