@@ -2922,6 +2922,16 @@ pass_ipa_strub::execute (function *)
if (nparmt)
adjust_ftype++;
}
+ else if (TREE_THIS_VOLATILE (parm))
+ {
+ /* Drop volatile from wrapper's arguments, they're just
+ temporaries copied to the wrapped function. ??? Should
+ we drop TYPE_QUAL_ATOMIC as well? */
+ TREE_TYPE (parm) = build_qualified_type (TREE_TYPE (parm),
+ TYPE_QUALS (TREE_TYPE (parm))
+ & ~TYPE_QUAL_VOLATILE);
+ TREE_THIS_VOLATILE (parm) = 0;
+ }
/* Also adjust the wrapped function type, if needed. */
if (adjust_ftype)
@@ -3224,9 +3234,7 @@ pass_ipa_strub::execute (function *)
{
tree tmp = arg;
/* If ARG is e.g. volatile, we must copy and
- convert in separate statements. ??? Should
- we drop volatile from the wrapper
- instead? */
+ convert in separate statements. */
if (!is_gimple_val (arg))
{
tmp = create_tmp_reg (TYPE_MAIN_VARIANT
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-options "-fdump-ipa-strub" } */
/* { dg-require-effective-target strub } */
void __attribute__ ((strub("internal")))
@@ -8,3 +9,7 @@ f(volatile short) {
void g(void) {
f(0);
}
+
+/* We drop volatile from the wrapper, and keep it in the wrapped f, so
+ the count remains 1. */
+/* { dg-final { scan-ipa-dump-times "volatile" 1 "strub" } } */