[llvm] r299412 - InstCombine: Use the InstSimplify hook for shufflevector
Zvi Rackover via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 3 21:47:58 PDT 2017
Author: zvi
Date: Mon Apr 3 23:47:57 2017
New Revision: 299412
URL: http://llvm.org/viewvc/llvm-project?rev=299412&view=rev
Log:
InstCombine: Use the InstSimplify hook for shufflevector
Summary: Start using the recently added InstSimplify hook for shuffles in the respective InstCombine visitor.
Reviewers: spatel, RKSimon, craig.topper, majnemer
Reviewed By: majnemer
Subscribers: majnemer, llvm-commits
Differential Revision: https://reviews.llvm.org/D31526
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp?rev=299412&r1=299411&r2=299412&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp Mon Apr 3 23:47:57 2017
@@ -1140,12 +1140,11 @@ Instruction *InstCombiner::visitShuffleV
SmallVector<int, 16> Mask = SVI.getShuffleMask();
Type *Int32Ty = Type::getInt32Ty(SVI.getContext());
- bool MadeChange = false;
-
- // Undefined shuffle mask -> undefined value.
- if (isa<UndefValue>(SVI.getOperand(2)))
- return replaceInstUsesWith(SVI, UndefValue::get(SVI.getType()));
+ if (auto *V = SimplifyShuffleVectorInst(LHS, RHS, SVI.getMask(),
+ SVI.getType(), DL, &TLI, &DT, &AC))
+ return replaceInstUsesWith(SVI, V);
+ bool MadeChange = false;
unsigned VWidth = SVI.getType()->getVectorNumElements();
APInt UndefElts(VWidth, 0);
More information about the llvm-commits
mailing list