summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-05-11 05:04:27 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-05-11 05:04:27 +0000
commit7536460c0f7560ded8f7eaf3079e7c367cf9339b (patch)
treef5ffb2ed0764bfefcab346f8ed7b3f62ba0ccbbd /llvm/lib/Transforms
parent58fb038b1b4636f0eb1ad12fd6cbd503e9f3f521 (diff)
downloadbcm5719-llvm-7536460c0f7560ded8f7eaf3079e7c367cf9339b.tar.gz
bcm5719-llvm-7536460c0f7560ded8f7eaf3079e7c367cf9339b.zip
[InstCombine] Canonicalize single element array store
Use the element type instead of the aggregate type. Differential Revision: http://reviews.llvm.org/D9591 llvm-svn: 236969
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
index 1b0518654a0..e74ab3c2afc 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
@@ -880,6 +880,15 @@ static bool unpackStoreToAggregate(InstCombiner &IC, StoreInst &SI) {
}
}
+ if (auto *AT = dyn_cast<ArrayType>(T)) {
+ // If the array only have one element, we unpack.
+ if (AT->getNumElements() == 1) {
+ V = IC.Builder->CreateExtractValue(V, 0);
+ combineStoreToNewValue(IC, SI, V);
+ return true;
+ }
+ }
+
return false;
}
OpenPOWER on IntegriCloud