diff options
author | Eric Christopher <echristo@apple.com> | 2011-08-23 20:11:10 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2011-08-23 20:11:10 +0000 |
commit | 7bc78f692c15916727e3ef2b74af1d38306c9d7e (patch) | |
tree | bd5ab9755d322142c7c1f9e6eb0c62ad092fb8ac /llvm/lib/VMCore/Constants.cpp | |
parent | 6763e387364eb3fb9376bc54348b924ec85a17b6 (diff) | |
download | bcm5719-llvm-7bc78f692c15916727e3ef2b74af1d38306c9d7e.tar.gz bcm5719-llvm-7bc78f692c15916727e3ef2b74af1d38306c9d7e.zip |
Revert "Address Duncan's CR request:"
This reverts commit 20a05be15ea5271ab6185b83200fa88263362400. (svn rev 138340)
Conflicts:
test/Transforms/InstCombine/bitcast.ll
llvm-svn: 138366
Diffstat (limited to 'llvm/lib/VMCore/Constants.cpp')
-rw-r--r-- | llvm/lib/VMCore/Constants.cpp | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index 8b41ab75e25..2f22cda5ba4 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/lib/VMCore/Constants.cpp @@ -62,21 +62,6 @@ bool Constant::isNullValue() const { return isa<ConstantAggregateZero>(this) || isa<ConstantPointerNull>(this); } -bool Constant::isAllOnesValue() const { - // Check for -1 integers - if (const ConstantInt *CI = dyn_cast<ConstantInt>(this)) - return CI->isAllOnesValue(); - - // +0.0 is null. - if (const ConstantFP *CFP = dyn_cast<ConstantFP>(this)) - return CFP->getValueAPF().bitcastToAPInt().isAllOnesValue(); - - // Check for constant vectors - if (const ConstantVector *CV = dyn_cast<ConstantVector>(this)) - return CV->isAllOnesValue(); - - return false; -} // Constructor to create a '0' constant of arbitrary type... Constant *Constant::getNullValue(Type *Ty) { switch (Ty->getTypeID()) { @@ -141,7 +126,7 @@ Constant *Constant::getAllOnesValue(Type *Ty) { SmallVector<Constant*, 16> Elts; VectorType *VTy = cast<VectorType>(Ty); Elts.resize(VTy->getNumElements(), getAllOnesValue(VTy->getElementType())); - assert(Elts[0] && "Invalid AllOnes value!"); + assert(Elts[0] && "Not a vector integer type!"); return cast<ConstantVector>(ConstantVector::get(Elts)); } @@ -1079,16 +1064,13 @@ bool ConstantVector::isAllOnesValue() const { // Check out first element. const Constant *Elt = getOperand(0); const ConstantInt *CI = dyn_cast<ConstantInt>(Elt); - const ConstantFP *CF = dyn_cast<ConstantFP>(Elt); - + if (!CI || !CI->isAllOnesValue()) return false; // Then make sure all remaining elements point to the same value. for (unsigned I = 1, E = getNumOperands(); I < E; ++I) if (getOperand(I) != Elt) return false; - // First value is all-ones. - return (CI && CI->isAllOnesValue()) || - (CF && CF->isAllOnesValue()); + return true; } /// getSplatValue - If this is a splat constant, where all of the |