From: Sanjay Patel Date: Fri, 11 Nov 2016 23:20:01 +0000 (+0000) Subject: [InstCombine] use dyn_cast rather isa+cast; NFC X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a8a96a9e94a456b11ec4256f5b8c583a988661f9;p=llvm [InstCombine] use dyn_cast rather isa+cast; NFC Follow-up to r286664 cleanup as suggested by Eli. Thanks! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286671 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstCombineSelect.cpp b/lib/Transforms/InstCombine/InstCombineSelect.cpp index 9c70f3e6d48..2c6b92ed295 100644 --- a/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -166,7 +166,8 @@ Instruction *InstCombiner::foldSelectOpOp(SelectInst &SI, Instruction *TI, // above, it may be possible to relax the one-use constraint, but that needs // be examined carefully since it may not reduce the total number of // instructions. - if (!isa(TI) || !TI->hasOneUse() || !FI->hasOneUse()) + BinaryOperator *BO = dyn_cast(TI); + if (!BO || !TI->hasOneUse() || !FI->hasOneUse()) return nullptr; // Figure out if the operations have any operands in common. @@ -201,7 +202,6 @@ Instruction *InstCombiner::foldSelectOpOp(SelectInst &SI, Instruction *TI, // If we reach here, they do have operations in common. Value *NewSI = Builder->CreateSelect(SI.getCondition(), OtherOpT, OtherOpF, SI.getName() + ".v", &SI); - BinaryOperator *BO = cast(TI); Value *Op0 = MatchIsOpZero ? MatchOp : NewSI; Value *Op1 = MatchIsOpZero ? NewSI : MatchOp; return BinaryOperator::Create(BO->getOpcode(), Op0, Op1);