From: Sanjay Patel Date: Wed, 5 Jun 2019 21:26:52 +0000 (+0000) Subject: [InstCombine] simplify code for bitcast of insertelement; NFC X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1e0bb8e40d99a751248dbfae98cbab026c016f84;p=llvm [InstCombine] simplify code for bitcast of insertelement; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362655 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstCombineCasts.cpp b/lib/Transforms/InstCombine/InstCombineCasts.cpp index 1faaf0bf6af..36be8bdf6f3 100644 --- a/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/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(CI.getOperand(0))) - return CastInst::Create(Instruction::BitCast, IEI->getOperand(1), - DestTy); + // component directly: + // bitcast (inselt <1 x elt> V, X, 0) to --> bitcast X to + if (auto *InsElt = dyn_cast(Src)) + return new BitCastInst(InsElt->getOperand(1), DestTy); } }