From: Zvi Rackover Date: Tue, 4 Apr 2017 04:47:57 +0000 (+0000) Subject: InstCombine: Use the InstSimplify hook for shufflevector X-Git-Tag: llvmorg-5.0.0-rc1~8578 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=82bf48d8b955c8b06eabc374196042d8ae14010d;p=platform%2Fupstream%2Fllvm.git 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 llvm-svn: 299412 --- diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp index c29d327..e89b400 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp @@ -1140,12 +1140,11 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) { SmallVector Mask = SVI.getShuffleMask(); Type *Int32Ty = Type::getInt32Ty(SVI.getContext()); - bool MadeChange = false; - - // Undefined shuffle mask -> undefined value. - if (isa(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);