summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize/BBVectorize.cpp
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2012-06-28 05:42:26 +0000
committerHal Finkel <hfinkel@anl.gov>2012-06-28 05:42:26 +0000
commit74e5225c92078c5ea15ea4bc19e86dd2e36a63f4 (patch)
tree753c2eb18617feb4c443f23c1beacb285fc1c2b7 /llvm/lib/Transforms/Vectorize/BBVectorize.cpp
parenta2ccbf0f85969807df1d77a2ff0c07ea0bb6bef2 (diff)
downloadbcm5719-llvm-74e5225c92078c5ea15ea4bc19e86dd2e36a63f4.tar.gz
bcm5719-llvm-74e5225c92078c5ea15ea4bc19e86dd2e36a63f4.zip
Refactor operation equivalence checking in BBVectorize by extending Instruction::isSameOperationAs.
Maintaining this kind of checking in different places is dangerous, extending Instruction::isSameOperationAs consolidates this logic into one place. Here I've added an optional flags parameter and two flags that are important for vectorization: CompareIgnoringAlignment and CompareUsingScalarTypes. llvm-svn: 159329
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/BBVectorize.cpp')
-rw-r--r--llvm/lib/Transforms/Vectorize/BBVectorize.cpp25
1 files changed, 2 insertions, 23 deletions
diff --git a/llvm/lib/Transforms/Vectorize/BBVectorize.cpp b/llvm/lib/Transforms/Vectorize/BBVectorize.cpp
index 85187310dd8..35e0d68b0af 100644
--- a/llvm/lib/Transforms/Vectorize/BBVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/BBVectorize.cpp
@@ -660,30 +660,9 @@ namespace {
// Loads and stores can be merged if they have different alignments,
// but are otherwise the same.
- LoadInst *LI, *LJ;
- StoreInst *SI, *SJ;
- if ((LI = dyn_cast<LoadInst>(I)) && (LJ = dyn_cast<LoadInst>(J))) {
- if (I->getType() != J->getType())
- return false;
-
- if (LI->getPointerOperand()->getType() !=
- LJ->getPointerOperand()->getType() ||
- LI->isVolatile() != LJ->isVolatile() ||
- LI->getOrdering() != LJ->getOrdering() ||
- LI->getSynchScope() != LJ->getSynchScope())
- return false;
- } else if ((SI = dyn_cast<StoreInst>(I)) && (SJ = dyn_cast<StoreInst>(J))) {
- if (SI->getValueOperand()->getType() !=
- SJ->getValueOperand()->getType() ||
- SI->getPointerOperand()->getType() !=
- SJ->getPointerOperand()->getType() ||
- SI->isVolatile() != SJ->isVolatile() ||
- SI->getOrdering() != SJ->getOrdering() ||
- SI->getSynchScope() != SJ->getSynchScope())
- return false;
- } else if (!J->isSameOperationAs(I)) {
+ if (!J->isSameOperationAs(I, Instruction::CompareIgnoringAlignment))
return false;
- }
+
// FIXME: handle addsub-type operations!
if (IsSimpleLoadStore) {
OpenPOWER on IntegriCloud