From: Chris Lattner Date: Tue, 14 Dec 2004 20:08:06 +0000 (+0000) Subject: Constant exprs are not efficiently negatable in practice. This disables X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0ce8580fcd23839b69eb36af7b0cb789be4b2763;p=oota-llvm.git Constant exprs are not efficiently negatable in practice. This disables turning X - (constantexpr) into X + (-constantexpr) among other things. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18935 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 807653b56d1..f78a14d4273 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -309,10 +309,9 @@ static inline Value *dyn_castNegVal(Value *V) { if (BinaryOperator::isNeg(V)) return BinaryOperator::getNegArgument(cast(V)); - // Constants can be considered to be negated values if they can be folded... - if (Constant *C = dyn_cast(V)) - if (!isa(C)) - return ConstantExpr::getNeg(C); + // Constants can be considered to be negated values if they can be folded. + if (ConstantInt *C = dyn_cast(V)) + return ConstantExpr::getNeg(C); return 0; }