diff options
author | Bill Wendling <isanbard@gmail.com> | 2008-12-01 21:03:43 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2008-12-01 21:03:43 +0000 |
commit | 84f6f2539f7a0a363e1b38bcff0c7ac21d301e2a (patch) | |
tree | 1a6400c2ecb8eba35efc96233c790dd1338a02ae /llvm/lib/Transforms | |
parent | e1908e393ed1c2465897eeeabcb5dde4898e6aa9 (diff) | |
download | bcm5719-llvm-84f6f2539f7a0a363e1b38bcff0c7ac21d301e2a.tar.gz bcm5719-llvm-84f6f2539f7a0a363e1b38bcff0c7ac21d301e2a.zip |
Document what this check is doing. Also, no need to cast to ConstantInt.
llvm-svn: 60369
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index e4ddecf7563..9ee375c3825 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -2933,10 +2933,10 @@ Instruction *InstCombiner::visitSDiv(BinaryOperator &I) { // -X/C -> X/-C, if and only if negation doesn't overflow. if (Value *LHSNeg = dyn_castNegVal(Op0)) { if (ConstantInt *CI = dyn_cast<ConstantInt>(LHSNeg)) { - ConstantInt *RHSNeg = cast<ConstantInt>(ConstantExpr::getNeg(RHS)); - if (RHS != RHSNeg) { - ConstantInt *CINeg = cast<ConstantInt>(ConstantExpr::getNeg(CI)); - if (CI != CINeg) + Constant *RHSNeg = ConstantExpr::getNeg(RHS); + if (RHS != RHSNeg) { // Check that there is no overflow. + Constant *CINeg = ConstantExpr::getNeg(CI); + if (CI != CINeg) // Check that there is no overflow. return BinaryOperator::CreateSDiv(LHSNeg, ConstantExpr::getNeg(RHS)); } |