[llvm] fc31b58 - [InstCombine] simplify code for shuffle mask canonicalization; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 25 08:12:59 PST 2019
Author: Sanjay Patel
Date: 2019-11-25T11:11:12-05:00
New Revision: fc31b58eff9da4447f9f332f07de3cd07ab4b56c
URL: https://github.com/llvm/llvm-project/commit/fc31b58eff9da4447f9f332f07de3cd07ab4b56c
DIFF: https://github.com/llvm/llvm-project/commit/fc31b58eff9da4447f9f332f07de3cd07ab4b56c.diff
LOG: [InstCombine] simplify code for shuffle mask canonicalization; NFC
We never use the local 'Mask' before returning, so that was dead code.
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 2f9d342daca0..fd31f524e5ce 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -1900,13 +1900,11 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
continue;
}
- if (Mask[i] < (int)LHSWidth && isa<UndefValue>(LHS)) {
- Mask[i] = -1; // Turn into undef.
+ // Change select of undef to undef mask element or force to LHS.
+ if (Mask[i] < (int)LHSWidth && isa<UndefValue>(LHS))
Elts.push_back(UndefValue::get(Int32Ty));
- } else {
- Mask[i] = Mask[i] % LHSWidth; // Force to LHS.
- Elts.push_back(ConstantInt::get(Int32Ty, Mask[i]));
- }
+ else
+ Elts.push_back(ConstantInt::get(Int32Ty, Mask[i] % LHSWidth));
}
SVI.setOperand(0, SVI.getOperand(1));
SVI.setOperand(1, UndefValue::get(RHS->getType()));
More information about the llvm-commits
mailing list