[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Apr 6 21:44:59 PDT 2006



Changes in directory llvm/lib/VMCore:

ConstantFolding.cpp updated: 1.85 -> 1.86
---
Log message:

Constant fold extractelement(zero, x) -> zero


---
Diffs of the changes:  (+3 -0)

 ConstantFolding.cpp |    3 +++
 1 files changed, 3 insertions(+)


Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.85 llvm/lib/VMCore/ConstantFolding.cpp:1.86
--- llvm/lib/VMCore/ConstantFolding.cpp:1.85	Sat Apr  1 19:38:28 2006
+++ llvm/lib/VMCore/ConstantFolding.cpp	Thu Apr  6 23:44:06 2006
@@ -836,6 +836,9 @@
                                                       const Constant *Idx) {
   if (isa<UndefValue>(Val))  // ee(undef, x) -> undef
     return UndefValue::get(cast<PackedType>(Val->getType())->getElementType());
+  if (Val->isNullValue())  // ee(zero, x) -> zero
+    return Constant::getNullValue(
+                          cast<PackedType>(Val->getType())->getElementType());
   
   if (const ConstantPacked *CVal = dyn_cast<ConstantPacked>(Val)) {
     if (const ConstantUInt *CIdx = dyn_cast<ConstantUInt>(Idx)) {






More information about the llvm-commits mailing list