summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-11-11 23:20:01 +0000
committerSanjay Patel <spatel@rotateright.com>2016-11-11 23:20:01 +0000
commit84ae943f0d1378239efa3db8bd7b48fa06d77582 (patch)
tree3f9466bbfe81f29a8332f57799b596c8950467b0 /llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
parent31f4eb5f5b20c2530b4920aa19f433804f74d60f (diff)
downloadbcm5719-llvm-84ae943f0d1378239efa3db8bd7b48fa06d77582.tar.gz
bcm5719-llvm-84ae943f0d1378239efa3db8bd7b48fa06d77582.zip
[InstCombine] use dyn_cast rather isa+cast; NFC
Follow-up to r286664 cleanup as suggested by Eli. Thanks! llvm-svn: 286671
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index 9c70f3e6d48..2c6b92ed295 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/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<BinaryOperator>(TI) || !TI->hasOneUse() || !FI->hasOneUse())
+ BinaryOperator *BO = dyn_cast<BinaryOperator>(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<BinaryOperator>(TI);
Value *Op0 = MatchIsOpZero ? MatchOp : NewSI;
Value *Op1 = MatchIsOpZero ? NewSI : MatchOp;
return BinaryOperator::Create(BO->getOpcode(), Op0, Op1);
OpenPOWER on IntegriCloud