[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Dec 14 12:08:22 PST 2004



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.294 -> 1.295
---
Log message:

Constant exprs are not efficiently negatable in practice.  This disables
turning X - (constantexpr) into X + (-constantexpr) among other things.



---
Diffs of the changes:  (+3 -4)

Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.294 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.295
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.294	Sun Dec 12 15:48:58 2004
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Tue Dec 14 14:08:06 2004
@@ -309,10 +309,9 @@
   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;
 }
 






More information about the llvm-commits mailing list