[llvm] 847aabf - [InstCombine] remove dead code from shuffle mask canonicalization; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 25 07:55:25 PST 2019
Author: Sanjay Patel
Date: 2019-11-25T10:54:18-05:00
New Revision: 847aabf11f988a774ae8078a2e567dad8c709bbe
URL: https://github.com/llvm/llvm-project/commit/847aabf11f988a774ae8078a2e567dad8c709bbe
DIFF: https://github.com/llvm/llvm-project/commit/847aabf11f988a774ae8078a2e567dad8c709bbe.diff
LOG: [InstCombine] remove dead code from shuffle mask canonicalization; NFC
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index eae8bd7452d4..2f9d342daca0 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -1891,6 +1891,7 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
SmallVector<int, 16> Mask = SVI.getShuffleMask();
Type *Int32Ty = Type::getInt32Ty(SVI.getContext());
if (LHS == RHS || isa<UndefValue>(LHS)) {
+ assert(!isa<UndefValue>(RHS) && "Shuffle with 2 undef ops not simplified?");
// Remap any references to RHS to use LHS.
SmallVector<Constant*, 16> Elts;
for (unsigned i = 0; i != VWidth; ++i) {
@@ -1899,8 +1900,7 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
continue;
}
- if ((Mask[i] >= (int)LHSWidth && isa<UndefValue>(RHS)) ||
- (Mask[i] < (int)LHSWidth && isa<UndefValue>(LHS))) {
+ if (Mask[i] < (int)LHSWidth && isa<UndefValue>(LHS)) {
Mask[i] = -1; // Turn into undef.
Elts.push_back(UndefValue::get(Int32Ty));
} else {
More information about the llvm-commits
mailing list