Commit 1bbc6693 by Xinliang David Li Committed by Xinliang David Li

Fix PR47707

From-SVN: r170062
parent 1da7d8c0
2011-02-11 Xinliang David Li <davidxl@google.com>
PR tree-optimization/47707
* tree-chrec.c (convert_affine_scev): Keep type precision.
2011-02-11 Eric Botcazou <ebotcazou@adacore.com> 2011-02-11 Eric Botcazou <ebotcazou@adacore.com>
PR tree-optimization/47420 PR tree-optimization/47420
......
2011-02-11 Xinliang David Li <davidxl@google.com>
PR tree-optimization/47707
* g++.dg/tree-ssa/pr47707.C: New test.
2011-02-11 Eric Botcazou <ebotcazou@adacore.com> 2011-02-11 Eric Botcazou <ebotcazou@adacore.com>
* g++.dg/opt/inline17.C: New test. * g++.dg/opt/inline17.C: New test.
......
/* { dg-do run } */
/* { dg-options "-O2 -fno-tree-vrp" } */
#include <assert.h>
struct CH
{
unsigned char ch : 3;
} ch;
__attribute__((noinline)) void MakeCheckOp (unsigned int *v1, unsigned int *v2)
{
assert (*v1 == *v2);
}
int main (void)
{
int len;
for (len = 4; len >= 1; len--)
{
unsigned v1, v2;
ch.ch = len;
v1 = ch.ch;
v2 = len;
MakeCheckOp (&v1, &v2);
}
}
...@@ -1238,8 +1238,11 @@ convert_affine_scev (struct loop *loop, tree type, ...@@ -1238,8 +1238,11 @@ convert_affine_scev (struct loop *loop, tree type,
performed by default when CT is signed. */ performed by default when CT is signed. */
new_step = *step; new_step = *step;
if (TYPE_PRECISION (step_type) > TYPE_PRECISION (ct) && TYPE_UNSIGNED (ct)) if (TYPE_PRECISION (step_type) > TYPE_PRECISION (ct) && TYPE_UNSIGNED (ct))
new_step = chrec_convert_1 (signed_type_for (ct), new_step, at_stmt, {
use_overflow_semantics); tree signed_ct = build_nonstandard_integer_type (TYPE_PRECISION (ct), 0);
new_step = chrec_convert_1 (signed_ct, new_step, at_stmt,
use_overflow_semantics);
}
new_step = chrec_convert_1 (step_type, new_step, at_stmt, use_overflow_semantics); new_step = chrec_convert_1 (step_type, new_step, at_stmt, use_overflow_semantics);
if (automatically_generated_chrec_p (new_base) if (automatically_generated_chrec_p (new_base)
...@@ -1579,4 +1582,3 @@ evolution_function_right_is_integer_cst (const_tree chrec) ...@@ -1579,4 +1582,3 @@ evolution_function_right_is_integer_cst (const_tree chrec)
return false; return false;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment