On 14/01/16 10:43, Richard Biener wrote:
On Wed, Jan 13, 2016 at 9:04 PM, Tom de Vries <tom_devr...@mentor.com> wrote:
Hi,
At r231739, there was an ICE when checking code generated by
oacc_xform_loop, in case the source contained an error.
Due to seen_error (), gimplification during oacc_xform_loop bailed out, and
an uninitialized var was introduced. Because of gimplifying in ssa mode,
that caused an ICE.
I can't reproduce this any longer, but I think the fix still makes sense.
The patch makes sure oacc_xform_loop gimplifies in non-ssa mode if
seen_error ().
I don't think it makes "sense" in any way. After seen_error () a following ICE
will be "confused after earlier errors" in release mode and thus I think that's
not an important problem to paper over with this kind of "hack".
I'd rather avoid doing any of omp-low if seen_error ()?
The error triggered in oacc_device_lower, so there's nothing we can do
before (in omp-low).
How about this fix, which replaces the oacc ifn calls with
zero-assignments if seen_error ()?
Thanks,
- Tom
Ignore oacc ifn if seen_error in execute_oacc_device_lower
---
gcc/omp-low.c | 39 ++++++++++++++++++++++++++++++++++-----
1 file changed, 34 insertions(+), 5 deletions(-)
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 2de3aeb..f678f05 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -20201,7 +20201,7 @@ execute_oacc_device_lower ()
/* Rewind to allow rescan. */
gsi_prev (&gsi);
- bool rescan = false, remove = false;
+ bool rescan = false, remove = false, assign_zero = false;
enum internal_fn ifn_code = gimple_call_internal_fn (call);
switch (ifn_code)
@@ -20209,11 +20209,25 @@ execute_oacc_device_lower ()
default: break;
case IFN_GOACC_LOOP:
+ if (seen_error ())
+ {
+ remove = true;
+ assign_zero = true;
+ break;
+ }
+
oacc_xform_loop (call);
rescan = true;
break;
case IFN_GOACC_REDUCTION:
+ if (seen_error ())
+ {
+ remove = true;
+ assign_zero = true;
+ break;
+ }
+
/* Mark the function for SSA renaming. */
mark_virtual_operands_for_renaming (cfun);
@@ -20228,6 +20242,13 @@ execute_oacc_device_lower ()
case IFN_UNIQUE:
{
+ if (seen_error ())
+ {
+ remove = true;
+ assign_zero = true;
+ break;
+ }
+
enum ifn_unique_kind kind
= ((enum ifn_unique_kind)
TREE_INT_CST_LOW (gimple_call_arg (call, 0)));
@@ -20266,11 +20287,19 @@ execute_oacc_device_lower ()
{
if (gimple_vdef (call))
replace_uses_by (gimple_vdef (call), gimple_vuse (call));
- if (gimple_call_lhs (call))
+ tree lhs = gimple_call_lhs (call);
+ if (lhs != NULL_TREE)
{
- /* Propagate the data dependency var. */
- gimple *ass = gimple_build_assign (gimple_call_lhs (call),
- gimple_call_arg (call, 1));
+ gimple *ass;
+ if (assign_zero)
+ {
+ tree zero = build_zero_cst (TREE_TYPE (lhs));
+ ass = gimple_build_assign (lhs, zero);
+ }
+ else
+ /* Propagate the data dependency var. */
+ ass = gimple_build_assign (lhs, gimple_call_arg (call, 1));
+
gsi_replace (&gsi, ass, false);
}
else