diff options
author | Sanjay Patel <spatel@rotateright.com> | 2019-06-05 21:26:52 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2019-06-05 21:26:52 +0000 |
commit | ac111e526dd7fdcc39f93fa4722e12fac1c8fcf4 (patch) | |
tree | d41fd78e58b06f76edadc7a3bb40ed6cbc974e58 /llvm/lib | |
parent | 663d762c9a5344c9209d1180e823fe22b26c433f (diff) | |
download | bcm5719-llvm-ac111e526dd7fdcc39f93fa4722e12fac1c8fcf4.tar.gz bcm5719-llvm-ac111e526dd7fdcc39f93fa4722e12fac1c8fcf4.zip |
[InstCombine] simplify code for bitcast of insertelement; NFC
llvm-svn: 362655
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index 1faaf0bf6af..36be8bdf6f3 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -2376,11 +2376,10 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) { } // Otherwise, see if our source is an insert. If so, then use the scalar - // component directly. - if (InsertElementInst *IEI = - dyn_cast<InsertElementInst>(CI.getOperand(0))) - return CastInst::Create(Instruction::BitCast, IEI->getOperand(1), - DestTy); + // component directly: + // bitcast (inselt <1 x elt> V, X, 0) to <n x m> --> bitcast X to <n x m> + if (auto *InsElt = dyn_cast<InsertElementInst>(Src)) + return new BitCastInst(InsElt->getOperand(1), DestTy); } } |