From 69fffa5437db31eaa9cb2a4d004a4cd02e06bfa3 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Mon, 1 Dec 2008 21:03:43 +0000 Subject: [PATCH] Document what this check is doing. Also, no need to cast to ConstantInt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60369 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/InstructionCombining.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index e4ddecf7563..9ee375c3825 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/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(LHSNeg)) { - ConstantInt *RHSNeg = cast(ConstantExpr::getNeg(RHS)); - if (RHS != RHSNeg) { - ConstantInt *CINeg = cast(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)); }