[llvm-commits] [llvm-gcc-4.2] r41290 - /llvm-gcc-4.2/trunk/gcc/fold-const.c
Duncan Sands
baldrick at free.fr
Wed Aug 22 12:53:19 PDT 2007
Author: baldrick
Date: Wed Aug 22 14:53:18 2007
New Revision: 41290
URL: http://llvm.org/viewvc/llvm-project?rev=41290&view=rev
Log:
Format as in mainline, and mention the corresponding
gcc revision. Note that this is only the correctness
part of Roger Sayle's patch 121251, not the efficiency
improvement in round_up. Original changelog entry:
2007-01-27 Roger Sayle <roger at eyesopen.com>
* fold-const.c (size_binop): In the fast-paths for X+0, 0+X, X-0 and
1*X check that the constant hasn't overflowed, to preserve the
TREE_OVERFLOW bit.
(round_up): Provide an efficient implementation when rouding-up an
INTEGER_CST to a power-of-two.
Modified:
llvm-gcc-4.2/trunk/gcc/fold-const.c
Modified: llvm-gcc-4.2/trunk/gcc/fold-const.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/fold-const.c?rev=41290&r1=41289&r2=41290&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/fold-const.c (original)
+++ llvm-gcc-4.2/trunk/gcc/fold-const.c Wed Aug 22 14:53:18 2007
@@ -1890,22 +1890,25 @@
if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST)
{
/* And some specific cases even faster than that. */
-/* LLVM local begin */
- if (code == PLUS_EXPR && integer_zerop (arg0)
- && !TREE_OVERFLOW (arg0))
-/* LLVM local end */
- return arg1;
- else if ((code == MINUS_EXPR || code == PLUS_EXPR)
-/* LLVM local begin */
- && integer_zerop (arg1)
- && !TREE_OVERFLOW (arg1))
-/* LLVM local end */
- return arg0;
-/* LLVM local begin */
- else if (code == MULT_EXPR && integer_onep (arg0)
- && !TREE_OVERFLOW (arg0))
-/* LLVM local end */
- return arg1;
+ /* LLVM local begin gcc 121252 */
+ if (code == PLUS_EXPR)
+ {
+ if (integer_zerop (arg0) && !TREE_OVERFLOW (arg0))
+ return arg1;
+ if (integer_zerop (arg1) && !TREE_OVERFLOW (arg1))
+ return arg0;
+ }
+ else if (code == MINUS_EXPR)
+ {
+ if (integer_zerop (arg1) && !TREE_OVERFLOW (arg1))
+ return arg0;
+ }
+ else if (code == MULT_EXPR)
+ {
+ if (integer_onep (arg0) && !TREE_OVERFLOW (arg0))
+ return arg1;
+ }
+ /* LLVM local end gcc 121252 */
/* Handle general case of two integer constants. */
return int_const_binop (code, arg0, arg1, 0);
More information about the llvm-commits
mailing list