On Fri, Nov 08, 2019 at 04:41:23PM +0100, Tobias Burnus wrote: > With DECL_ARTIFICIAL added and also_value replaced: > Build on x86-64-gnu-linux. OK once regtested?
Almost. > - gimplify_assign (x, var, &ilist); > + if (do_optional_check && omp_check_optional_argument (ovar, true)) Do you need true here when just testing for non-NULL? If yes, it would be better to call it just once, so that e.g. the DECL_ARGUMENTS list is not walked twice. So perhaps: tree present; present = (do_optional_check ? omp_check_optional_argument (ovar, true) : NULL_TREE); if (present) { > + { > + tree null_label = create_artificial_label (UNKNOWN_LOCATION); > + tree notnull_label = create_artificial_label (UNKNOWN_LOCATION); > + tree opt_arg_label = create_artificial_label (UNKNOWN_LOCATION); I this this is already too long, so needs line wrapping before =. > + tree new_x = unshare_expr (x); > + tree present = omp_check_optional_argument (ovar, true); And not call it here again. > + gimplify_expr (&present, &ilist, NULL, is_gimple_val, > + fb_rvalue); > + gcond *cond = gimple_build_cond_from_tree (present, > + notnull_label, > + null_label); > + gimple_seq_add_stmt (&ilist, cond); > + gimple_seq_add_stmt (&ilist, gimple_build_label (null_label)); > + gimplify_assign (new_x, null_pointer_node, &ilist); > + gimple_seq_add_stmt (&ilist, gimple_build_goto (opt_arg_label)); And here similarly. > + if (do_optional_check > + && omp_check_optional_argument (OMP_CLAUSE_DECL (c), true)) > + { > + tree null_label = create_artificial_label (UNKNOWN_LOCATION); > + tree notnull_label = create_artificial_label (UNKNOWN_LOCATION); > + tree opt_arg_label = create_artificial_label (UNKNOWN_LOCATION); > + glabel *null_glabel = gimple_build_label (null_label); > + glabel *notnull_glabel = gimple_build_label (notnull_label); > + ggoto *opt_arg_ggoto = gimple_build_goto (opt_arg_label); > + gimplify_expr (&x, &new_body, NULL, is_gimple_val, > + fb_rvalue); > + tree present = omp_check_optional_argument (OMP_CLAUSE_DECL (c), > + true); Similarly to the above. Otherwise LGTM. Jakub