From: Dan Gohman Date: Thu, 11 Sep 2008 22:47:57 +0000 (+0000) Subject: Fix a vectorshuffle instcombine bug introduced by r55995. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3139ff8f7b5e3eeb170d77ac8472fc4ca596ec0e;p=oota-llvm.git Fix a vectorshuffle instcombine bug introduced by r55995. Patch by Nicolas Capens! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56129 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 5a9d1de2e35..f02a7108fd6 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -11311,8 +11311,11 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) { unsigned VWidth = cast(SVI.getType())->getNumElements(); uint64_t AllOnesEltMask = ~0ULL >> (64-VWidth); if (VWidth <= 64 && - SimplifyDemandedVectorElts(&SVI, AllOnesEltMask, UndefElts)) + SimplifyDemandedVectorElts(&SVI, AllOnesEltMask, UndefElts)) { + LHS = SVI.getOperand(0); + RHS = SVI.getOperand(1); MadeChange = true; + } // Canonicalize shuffle(x ,x,mask) -> shuffle(x, undef,mask') // Canonicalize shuffle(undef,x,mask) -> shuffle(x, undef,mask'). diff --git a/test/Transforms/InstCombine/pr2645-0.ll b/test/Transforms/InstCombine/pr2645-0.ll new file mode 100644 index 00000000000..04cc1852cb2 --- /dev/null +++ b/test/Transforms/InstCombine/pr2645-0.ll @@ -0,0 +1,33 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {insertelement <4 x float> undef} + +; Instcombine should be able to prove that none of the +; insertelement's first operand's elements are needed. + +define internal void @""(i8*) { +;