diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2014-04-11 19:35:42 +0000 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2014-04-11 19:35:42 +0000 |
commit | 644b118230739c647a61e658060be17650f1d7f8 (patch) | |
tree | 1ff5c5ab78a046836672f3bb4b9e5cf60e0a4ac2 /lib | |
parent | efc99c219662a8644c4ea290a9936b330b20acf6 (diff) | |
download | llvm-644b118230739c647a61e658060be17650f1d7f8.tar.gz llvm-644b118230739c647a61e658060be17650f1d7f8.tar.bz2 llvm-644b118230739c647a61e658060be17650f1d7f8.tar.xz |
Merging r200028:
------------------------------------------------------------------------
r200028 | benny.kra | 2014-01-24 14:02:37 -0500 (Fri, 24 Jan 2014) | 4 lines
InstCombine: Don't try to use aggregate elements of ConstantExprs.
PR18600.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@206054 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineVectorOps.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/lib/Transforms/InstCombine/InstCombineVectorOps.cpp index 1e72410699..30290ee7a7 100644 --- a/lib/Transforms/InstCombine/InstCombineVectorOps.cpp +++ b/lib/Transforms/InstCombine/InstCombineVectorOps.cpp @@ -25,11 +25,13 @@ static bool CheapToScalarize(Value *V, bool isConstant) { if (isConstant) return true; // If all elts are the same, we can extract it and use any of the values. - Constant *Op0 = C->getAggregateElement(0U); - for (unsigned i = 1, e = V->getType()->getVectorNumElements(); i != e; ++i) - if (C->getAggregateElement(i) != Op0) - return false; - return true; + if (Constant *Op0 = C->getAggregateElement(0U)) { + for (unsigned i = 1, e = V->getType()->getVectorNumElements(); i != e; + ++i) + if (C->getAggregateElement(i) != Op0) + return false; + return true; + } } Instruction *I = dyn_cast<Instruction>(V); if (!I) return false; |