https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65887
Bug ID: 65887 Summary: remove va_arg ap copies Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vries at gcc dot gnu.org [ Discussed here: https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01262.html ] When compiling gcc.target/x86_64/abi/callabi/vaarg-6.c, at original we have: ... ;; Function do_cpy2 (null) { char * e; char * e; e = VA_ARG_EXPR <argp>; e = VA_ARG_EXPR <argp>; if (e != b) { abort (); } } ... and after gimplify we have: ... do_cpy2 (char * argp) { char * argp.1; char * argp.2; char * b.3; char * e; argp.1 = argp; e = VA_ARG (&argp.1, 0B); argp = argp.1; argp.2 = argp; e = VA_ARG (&argp.2, 0B); argp = argp.2; b.3 = b; if (e != b.3) goto <D.1373>; else goto <D.1374>; <D.1373>: abort (); <D.1374>: } ... We'd like to generate: ... e = VA_ARG (&argp, 0B); ... instead of: ... argp.1 = argp; e = VA_ARG (&argp.1, 0B); argp = argp.1; ... The code generating the copyback 'argp = argp.1' is in gimplify_modify_expr.