summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2011-06-18 06:17:51 +0000
committerCameron Zwarich <zwarich@apple.com>2011-06-18 06:17:51 +0000
commit9601ddb2f306b6fad7aa1e34ccd3973fe7145275 (patch)
treed5049ea6eb0d258744dd55ff18a74dde99c8fea6 /llvm/lib/Transforms/Scalar
parent80ed9dc9e58f356139785cfb6a9f24cb64b76986 (diff)
downloadbcm5719-llvm-9601ddb2f306b6fad7aa1e34ccd3973fe7145275.tar.gz
bcm5719-llvm-9601ddb2f306b6fad7aa1e34ccd3973fe7145275.zip
When scalar replacement returns a vector type, only accept it if the vector
type's bitwidth matches the (allocated) size of the alloca. This severely pessimizes vector scalar replacement when the only vector type being used is something like <3 x float> on x86 or ARM whose allocated size matches a <4 x float>. I hope to fix some of the flawed assumptions about allocated size throughout scalar replacement and reenable this in most cases. llvm-svn: 133338
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index 38942dcb55c..46ac9482006 100644
--- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
@@ -293,6 +293,11 @@ AllocaInst *ConvertToScalarInfo::TryConvert(AllocaInst *AI) {
if (ScalarKind == Unknown)
ScalarKind = Integer;
+ // FIXME: It should be possible to promote the vector type up to the alloca's
+ // size.
+ if (ScalarKind == Vector && VectorTy->getBitWidth() != AllocaSize * 8)
+ ScalarKind = Integer;
+
// If we were able to find a vector type that can handle this with
// insert/extract elements, and if there was at least one use that had
// a vector type, promote this to a vector. We don't want to promote
OpenPOWER on IntegriCloud