diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-04-07 04:44:06 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-04-07 04:44:06 +0000 |
| commit | e4f9d7b23cbf6170b1e2d00b8511174ecf6a7d7b (patch) | |
| tree | d4b4f958efe7392c890ffac90cfb7319518d7d5a | |
| parent | 8ec0205de4b840c0a0ec4dbccf6dd24ce8b9fd0e (diff) | |
| download | bcm5719-llvm-e4f9d7b23cbf6170b1e2d00b8511174ecf6a7d7b.tar.gz bcm5719-llvm-e4f9d7b23cbf6170b1e2d00b8511174ecf6a7d7b.zip | |
Constant fold extractelement(zero, x) -> zero
llvm-svn: 27479
| -rw-r--r-- | llvm/lib/VMCore/ConstantFolding.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/ConstantFolding.cpp b/llvm/lib/VMCore/ConstantFolding.cpp index d63fb6b2db1..94c8651609d 100644 --- a/llvm/lib/VMCore/ConstantFolding.cpp +++ b/llvm/lib/VMCore/ConstantFolding.cpp @@ -836,6 +836,9 @@ Constant *llvm::ConstantFoldExtractElementInstruction(const Constant *Val, 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)) { |

