summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2011-02-01 08:39:12 +0000
committerDuncan Sands <baldrick@free.fr>2011-02-01 08:39:12 +0000
commitcf0ff030a84c8058a980334add88c296a53ca4e3 (patch)
tree66174501016b8d88cff233d5e9bcf8eead8bd77f /llvm/lib
parent9361be98d59f607df556c9be62045af103ab7e44 (diff)
downloadbcm5719-llvm-cf0ff030a84c8058a980334add88c296a53ca4e3.tar.gz
bcm5719-llvm-cf0ff030a84c8058a980334add88c296a53ca4e3.zip
Have m_One also match constant vectors for which every element is 1.
llvm-svn: 124655
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp6
-rw-r--r--llvm/lib/VMCore/Constants.cpp2
2 files changed, 1 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index a907150b9a2..bce9a1fa078 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -785,12 +785,6 @@ static Value *SimplifyDiv(unsigned Opcode, Value *Op0, Value *Op1,
// X / 1 -> X
if (match(Op1, m_One()))
return Op0;
- // Vector case. TODO: Have m_One match vectors.
- if (ConstantVector *Op1V = dyn_cast<ConstantVector>(Op1)) {
- if (ConstantInt *X = cast_or_null<ConstantInt>(Op1V->getSplatValue()))
- if (X->isOne())
- return Op0;
- }
if (Op0->getType()->isIntegerTy(1))
// It can't be division by zero, hence it must be division by one.
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp
index 3521ee7b16c..62117b22e6c 100644
--- a/llvm/lib/VMCore/Constants.cpp
+++ b/llvm/lib/VMCore/Constants.cpp
@@ -1033,7 +1033,7 @@ bool ConstantVector::isAllOnesValue() const {
/// getSplatValue - If this is a splat constant, where all of the
/// elements have the same value, return that value. Otherwise return null.
-Constant *ConstantVector::getSplatValue() {
+Constant *ConstantVector::getSplatValue() const {
// Check out first element.
Constant *Elt = getOperand(0);
// Then make sure all remaining elements point to the same value.
OpenPOWER on IntegriCloud