diff options
| author | Chris Lattner <sabre@nondot.org> | 2004-12-14 20:08:06 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2004-12-14 20:08:06 +0000 | 
| commit | 9ad0d55025563fa523c5fddd6d5152bfe09980e9 (patch) | |
| tree | a5d0a7aee0b92eb3f4cfea3bd53dbf0ec620721a /llvm/lib/Transforms | |
| parent | c936ad12089e02e948928329ffec48d4bc3b83d4 (diff) | |
| download | bcm5719-llvm-9ad0d55025563fa523c5fddd6d5152bfe09980e9.tar.gz bcm5719-llvm-9ad0d55025563fa523c5fddd6d5152bfe09980e9.zip | |
Constant exprs are not efficiently negatable in practice.  This disables
turning X - (constantexpr) into X + (-constantexpr) among other things.
llvm-svn: 18935
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 7 | 
1 files changed, 3 insertions, 4 deletions
| diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 807653b56d1..f78a14d4273 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -309,10 +309,9 @@ static inline Value *dyn_castNegVal(Value *V) {    if (BinaryOperator::isNeg(V))      return BinaryOperator::getNegArgument(cast<BinaryOperator>(V)); -  // Constants can be considered to be negated values if they can be folded... -  if (Constant *C = dyn_cast<Constant>(V)) -    if (!isa<UndefValue>(C)) -      return ConstantExpr::getNeg(C); +  // Constants can be considered to be negated values if they can be folded. +  if (ConstantInt *C = dyn_cast<ConstantInt>(V)) +    return ConstantExpr::getNeg(C);    return 0;  } | 

