Ignore oacc ifn if seen_error in execute_oacc_device_lower
---
gcc/omp-low.c | 39 ++++++++++++++++++++++++++++++++++-----
1 file changed, 34 insertions(+), 5 deletions(-)
@@ -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