This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR middle-end/14490

On Jul 1, 2005, at 6:42 AM, Richard Earnshaw wrote:

On Thu, 2005-06-30 at 20:10, Andrew Pinski wrote:
+      /* Transform comparisons of the form X +- C1 CMP C2 to X CMP C2
+- C1.  */
+      if ((TREE_CODE (arg0) == PLUS_EXPR || TREE_CODE (arg0) ==
+         && ((TREE_CODE (TREE_OPERAND (arg0, 1)) == REAL_CST
+              && !HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg0))))
+             || (TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST
+                 && !TREE_OVERFLOW (TREE_OPERAND (arg0, 1))
+                 && !TYPE_UNSIGNED (TREE_TYPE (arg1))
+                 && !(flag_wrapv || flag_trapv)))
+         && (TREE_CODE (arg1) == REAL_CST
+             || (TREE_CODE (arg1) == INTEGER_CST
+                 && !TREE_OVERFLOW (arg1))))
+       {

I think you need to be more conservative than this for REAL_CST.
Consider the case where CST1 and CST2 are the same (so the difference is
zero) and X is much smaller than CST1.

I attached the wrong patch, I had meant to the following which already removed the checks for REAL_CST.

Andrew Pinski

Attachment: t.diff.txt
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]