Richard Guenther - Re: [patch] (-fstrict-overflow) optimize counted loops on signed iv (original) (raw)
This is the mail archive of the gcc-patches@gcc.gnu.orgmailing list for the GCC project.
On 2/15/07, Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz wrote:
Hello,
On 2/15/07, Christian BRUEL christian.bruel@st.com wrote:
for my curiosity, I just had a quick look at fold-const and it looks like 'fold_relational_const' only handle the case were ops are INTEGER_CST :
Look in fold_comparison instead. This is already handled.
no it is not (or at least, I cannot find it anywhere, and the transformations do not seem to be performed)?
I thought this one in fold_binary should handle it:
case LT_EXPR:
case GT_EXPR:
case LE_EXPR:
case GE_EXPR:
tem = fold_comparison (code, type, op0, op1);
if (tem != NULL_TREE)
return tem;
/* Transform comparisons of the form X +- C CMP X. */
if ((TREE_CODE (arg0) == PLUS_EXPR || TREE_CODE (arg0) == MINUS_EXPR)
&& operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0)
&& ((TREE_CODE (TREE_OPERAND (arg0, 1)) == REAL_CST
&& !HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg0))))
|| (TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST
&& TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (arg1)))))
{
...