diff options
author | Juneyoung Lee <aqjune@gmail.com> | 2020-12-30 07:28:17 +0900 |
---|---|---|
committer | Juneyoung Lee <aqjune@gmail.com> | 2020-12-30 22:36:08 +0900 |
commit | 9b29610228c838a66a88edf43ddd25acf8d1b477 (patch) | |
tree | 96957ab446c808c9fd07ac66d17e179f14324d2b /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | e47e313d647e00ab5fbb4a17f9b69f33c49aafc3 (diff) | |
download | llvm-9b29610228c838a66a88edf43ddd25acf8d1b477.zip llvm-9b29610228c838a66a88edf43ddd25acf8d1b477.tar.gz llvm-9b29610228c838a66a88edf43ddd25acf8d1b477.tar.bz2 |
Use unary CreateShuffleVector if possible
As mentioned in D93793, there are quite a few places where unary `IRBuilder::CreateShuffleVector(X, Mask)` can be used
instead of `IRBuilder::CreateShuffleVector(X, Undef, Mask)`.
Let's update them.
Actually, it would have been more natural if the patches were made in this order:
(1) let them use unary CreateShuffleVector first
(2) update IRBuilder::CreateShuffleVector to use poison as a placeholder value (D93793)
The order is swapped, but in terms of correctness it is still fine.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D93923
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 0698c3c..3ea758a 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -6723,8 +6723,7 @@ bool CodeGenPrepare::optimizeShuffleVectorInst(ShuffleVectorInst *SVI) { cast<Instruction>(SVI->getOperand(0))->getOperand(1), NewType); Value *Insert = Builder.CreateInsertElement(UndefValue::get(NewVecType), BC1, (uint64_t)0); - Value *Shuffle = Builder.CreateShuffleVector( - Insert, UndefValue::get(NewVecType), SVI->getShuffleMask()); + Value *Shuffle = Builder.CreateShuffleVector(Insert, SVI->getShuffleMask()); Value *BC2 = Builder.CreateBitCast(Shuffle, SVIVecType); SVI->replaceAllUsesWith(BC2); |