blob: 825b9b74eeafc11929723550c4579f64970edaaf [file] [log] [blame]
Eric Christopher5dcca662011-07-27 23:46:26 +00001// RUN: %clang_cc1 -emit-llvm -o - %s | not grep readonly
2// RUN: %clang_cc1 -emit-llvm -o - %s | not grep readnone
Eric Christopher3883e662011-07-26 22:17:02 +00003
4// The struct being passed byval means that we cannot mark the
5// function readnone. Readnone would allow stores to the arg to
6// be deleted in the caller. We also don't allow readonly since
7// the callee might write to the byval parameter. The inliner
8// would have to assume the worse and introduce an explicit
9// temporary when inlining such a function, which is costly for
10// the common case in which the byval argument is not written.
11struct S { int A[1000]; };
12int __attribute__ ((const)) f(struct S x) { x.A[1] = 0; return x.A[0]; }
13int g(struct S x) __attribute__ ((pure));
14int h(struct S x) { return g(x); }