summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2012-11-12 14:50:59 +0000
committerHal Finkel <hfinkel@anl.gov>2012-11-12 14:50:59 +0000
commitef53df0f9f4af2dd804710e90e6784fb2b4934c0 (patch)
tree633fe294c987c720882d433a2f06b74fb815986f /llvm/lib/Transforms
parent5a578119ad0bcdcf5b8642d15ac55cef4d8c7bbb (diff)
downloadbcm5719-llvm-ef53df0f9f4af2dd804710e90e6784fb2b4934c0.tar.gz
bcm5719-llvm-ef53df0f9f4af2dd804710e90e6784fb2b4934c0.zip
BBVectorize: Check the input types of shuffles for legality
This fixes a bug where shuffles were being fused such that the resulting input types were not legal on the target. This would occur only when both inputs and dependencies were also foldable operations (such as other shuffles) and there were other connected pairs in the same block. llvm-svn: 167731
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Vectorize/BBVectorize.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Vectorize/BBVectorize.cpp b/llvm/lib/Transforms/Vectorize/BBVectorize.cpp
index 4653a7d7c8c..93cd27e02d9 100644
--- a/llvm/lib/Transforms/Vectorize/BBVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/BBVectorize.cpp
@@ -483,6 +483,8 @@ namespace {
if (SelectInst *SI = dyn_cast<SelectInst>(I)) {
T2 = SI->getCondition()->getType();
+ } else if (ShuffleVectorInst *SI = dyn_cast<ShuffleVectorInst>(I)) {
+ T2 = SI->getOperand(0)->getType();
}
}
@@ -987,10 +989,11 @@ namespace {
// We don't want to fuse to a type that will be split, even
// if the two input types will also be split and there is no other
// associated cost.
- unsigned VParts = VTTI->getNumberOfParts(VT1);
- if (VParts > 1)
+ unsigned VParts1 = VTTI->getNumberOfParts(VT1),
+ VParts2 = VTTI->getNumberOfParts(VT2);
+ if (VParts1 > 1 || VParts2 > 1)
return false;
- else if (!VParts && VCost == ICost + JCost)
+ else if ((!VParts1 || !VParts2) && VCost == ICost + JCost)
return false;
CostSavings = ICost + JCost - VCost;
OpenPOWER on IntegriCloud