diff options
author | Sanjay Patel <spatel@rotateright.com> | 2018-08-29 14:42:12 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2018-08-29 14:42:12 +0000 |
commit | d4e19d272ac93885f235ef83bd96ac633ec0d56f (patch) | |
tree | 6ac45b0c8f5e09a2d197f467b2e939e6209c28e4 /llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp | |
parent | 51c9349ab35f7c2707532b8d88c4a45c56117615 (diff) | |
download | bcm5719-llvm-d4e19d272ac93885f235ef83bd96ac633ec0d56f.tar.gz bcm5719-llvm-d4e19d272ac93885f235ef83bd96ac633ec0d56f.zip |
[InstCombine] move declarations closer to uses; NFC
llvm-svn: 340930
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp index 7be6dd02794..b415c830c57 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp @@ -1353,9 +1353,6 @@ static Instruction *foldSelectShuffle(ShuffleVectorInst &Shuf, Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) { Value *LHS = SVI.getOperand(0); Value *RHS = SVI.getOperand(1); - SmallVector<int, 16> Mask = SVI.getShuffleMask(); - Type *Int32Ty = Type::getInt32Ty(SVI.getContext()); - if (auto *V = SimplifyShuffleVectorInst( LHS, RHS, SVI.getMask(), SVI.getType(), SQ.getWithInstruction(&SVI))) return replaceInstUsesWith(SVI, V); @@ -1363,9 +1360,7 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) { if (Instruction *I = foldSelectShuffle(SVI, Builder, DL)) return I; - bool MadeChange = false; unsigned VWidth = SVI.getType()->getVectorNumElements(); - APInt UndefElts(VWidth, 0); APInt AllOnesEltMask(APInt::getAllOnesValue(VWidth)); if (Value *V = SimplifyDemandedVectorElts(&SVI, AllOnesEltMask, UndefElts)) { @@ -1374,7 +1369,10 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) { return &SVI; } + SmallVector<int, 16> Mask = SVI.getShuffleMask(); + Type *Int32Ty = Type::getInt32Ty(SVI.getContext()); unsigned LHSWidth = LHS->getType()->getVectorNumElements(); + bool MadeChange = false; // Canonicalize shuffle(x ,x,mask) -> shuffle(x, undef,mask') // Canonicalize shuffle(undef,x,mask) -> shuffle(x, undef,mask'). |