From 3139ff8f7b5e3eeb170d77ac8472fc4ca596ec0e Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 11 Sep 2008 22:47:57 +0000 Subject: [PATCH] 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 --- .../Scalar/InstructionCombining.cpp | 5 ++- .../InstCombine/{pr2645.ll => pr2645-0.ll} | 0 test/Transforms/InstCombine/pr2645-1.ll | 39 +++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) rename test/Transforms/InstCombine/{pr2645.ll => pr2645-0.ll} (100%) create mode 100644 test/Transforms/InstCombine/pr2645-1.ll 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.ll b/test/Transforms/InstCombine/pr2645-0.ll similarity index 100% rename from test/Transforms/InstCombine/pr2645.ll rename to test/Transforms/InstCombine/pr2645-0.ll diff --git a/test/Transforms/InstCombine/pr2645-1.ll b/test/Transforms/InstCombine/pr2645-1.ll new file mode 100644 index 00000000000..194d2cd18f7 --- /dev/null +++ b/test/Transforms/InstCombine/pr2645-1.ll @@ -0,0 +1,39 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep shufflevector +; PR2645 + +; instcombine shouldn't delete the shufflevector. + +define internal void @""(i8*, i32, i8*) { +;