Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.454 -> 1.455
---
Log message:

extractelement(undef,x) -> undef


---
Diffs of the changes:  (+8 -6)

 InstructionCombining.cpp |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.454 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.455
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.454   Thu Mar 30 
16:02:40 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri Mar 31 12:25:14 2006
@@ -6655,12 +6655,14 @@
 }
 
 Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) {
-  if (ConstantAggregateZero *C = 
-      dyn_cast<ConstantAggregateZero>(EI.getOperand(0))) {
-    // If packed val is constant 0, replace extract with scalar 0
-    const Type *Ty = cast<PackedType>(C->getType())->getElementType();
-    return ReplaceInstUsesWith(EI, Constant::getNullValue(Ty));
-  }
+  // If packed val is undef, replace extract with scalar undef.
+  if (isa<UndefValue>(EI.getOperand(0)))
+    return ReplaceInstUsesWith(EI, UndefValue::get(EI.getType()));
+
+  // If packed val is constant 0, replace extract with scalar 0.
+  if (isa<ConstantAggregateZero>(EI.getOperand(0)))
+    return ReplaceInstUsesWith(EI, Constant::getNullValue(EI.getType()));
+  
   if (ConstantPacked *C = dyn_cast<ConstantPacked>(EI.getOperand(0))) {
     // If packed val is constant with uniform operands, replace EI
     // with that operand



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to