diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-01-21 01:12:09 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-01-21 01:12:09 +0000 |
commit | 39b12c059dba3dcaf0315a382cc8f8948e77f90a (patch) | |
tree | d2d1d53d979e084f77e55516d5f7fc9fec48f697 /llvm/lib/VMCore/ConstantFold.cpp | |
parent | 9b175e0512b72ec43761c5bf5b47410fa92497d4 (diff) | |
download | bcm5719-llvm-39b12c059dba3dcaf0315a382cc8f8948e77f90a.tar.gz bcm5719-llvm-39b12c059dba3dcaf0315a382cc8f8948e77f90a.zip |
Add a constant folding of casts from zero to zero. Fixes PR9011!
While here, I'd like to complain about how vector is not an aggregate type
according to llvm::Type::isAggregateType(), but they're listed under aggregate
types in the LangRef and zero vectors are stored as ConstantAggregateZero.
llvm-svn: 123956
Diffstat (limited to 'llvm/lib/VMCore/ConstantFold.cpp')
-rw-r--r-- | llvm/lib/VMCore/ConstantFold.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/ConstantFold.cpp b/llvm/lib/VMCore/ConstantFold.cpp index a21b4a28e47..3fea1910ffe 100644 --- a/llvm/lib/VMCore/ConstantFold.cpp +++ b/llvm/lib/VMCore/ConstantFold.cpp @@ -511,10 +511,14 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V, return Constant::getNullValue(DestTy); return UndefValue::get(DestTy); } + // No compile-time operations on this type yet. if (V->getType()->isPPC_FP128Ty() || DestTy->isPPC_FP128Ty()) return 0; + if (V->isNullValue() && !DestTy->isX86_MMXTy()) + return Constant::getNullValue(DestTy); + // If the cast operand is a constant expression, there's a few things we can // do to try to simplify it. if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) { |