summaryrefslogtreecommitdiff
path: root/include/llvm/Support/PatternMatch.h
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2012-02-10 14:26:42 +0000
committerDuncan Sands <baldrick@free.fr>2012-02-10 14:26:42 +0000
commitedfb931edbf31f8de132834e064ede723ac74d23 (patch)
treea9206df8ac8b7c0f33ea54ab146ed6a4841f2548 /include/llvm/Support/PatternMatch.h
parentc667ba69ac342563c0886e20509e68705d78a0a5 (diff)
downloadllvm-edfb931edbf31f8de132834e064ede723ac74d23.tar.gz
llvm-edfb931edbf31f8de132834e064ede723ac74d23.tar.bz2
llvm-edfb931edbf31f8de132834e064ede723ac74d23.tar.xz
Revert commit 149912 (lattner) and add a testcase that shows the problem (which
is that patterns no longer match for vectors of booleans, because you only get ConstantDataVector when the vector element type is i8, i16, etc, not when it is i1). Original commit message: Remove some dead code and tidy things up now that vectors use ConstantDataVector instead of always using ConstantVector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150246 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/PatternMatch.h')
-rw-r--r--include/llvm/Support/PatternMatch.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h
index 8c68fcb691..221fa8b3eb 100644
--- a/include/llvm/Support/PatternMatch.h
+++ b/include/llvm/Support/PatternMatch.h
@@ -98,6 +98,13 @@ struct apint_match {
Res = &CI->getValue();
return true;
}
+ // FIXME: Remove this.
+ if (ConstantVector *CV = dyn_cast<ConstantVector>(V))
+ if (ConstantInt *CI =
+ dyn_cast_or_null<ConstantInt>(CV->getSplatValue())) {
+ Res = &CI->getValue();
+ return true;
+ }
if (ConstantDataVector *CV = dyn_cast<ConstantDataVector>(V))
if (ConstantInt *CI =
dyn_cast_or_null<ConstantInt>(CV->getSplatValue())) {
@@ -144,6 +151,10 @@ struct cst_pred_ty : public Predicate {
bool match(ITy *V) {
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V))
return this->isValue(CI->getValue());
+ // FIXME: Remove this.
+ if (const ConstantVector *CV = dyn_cast<ConstantVector>(V))
+ if (ConstantInt *CI = dyn_cast_or_null<ConstantInt>(CV->getSplatValue()))
+ return this->isValue(CI->getValue());
if (const ConstantDataVector *CV = dyn_cast<ConstantDataVector>(V))
if (ConstantInt *CI = dyn_cast_or_null<ConstantInt>(CV->getSplatValue()))
return this->isValue(CI->getValue());
@@ -165,6 +176,14 @@ struct api_pred_ty : public Predicate {
return true;
}
+ // FIXME: remove.
+ if (const ConstantVector *CV = dyn_cast<ConstantVector>(V))
+ if (ConstantInt *CI = dyn_cast_or_null<ConstantInt>(CV->getSplatValue()))
+ if (this->isValue(CI->getValue())) {
+ Res = &CI->getValue();
+ return true;
+ }
+
if (const ConstantDataVector *CV = dyn_cast<ConstantDataVector>(V))
if (ConstantInt *CI = dyn_cast_or_null<ConstantInt>(CV->getSplatValue()))
if (this->isValue(CI->getValue())) {
@@ -613,7 +632,9 @@ struct not_match {
}
private:
bool matchIfNot(Value *LHS, Value *RHS) {
- return (isa<ConstantInt>(RHS) || isa<ConstantDataVector>(RHS)) &&
+ return (isa<ConstantInt>(RHS) || isa<ConstantDataVector>(RHS) ||
+ // FIXME: Remove CV.
+ isa<ConstantVector>(RHS)) &&
cast<Constant>(RHS)->isAllOnesValue() &&
L.match(LHS);
}