On Wed, Dec 7, 2011 at 4:25 PM, Andrew Pinski <[email protected]> wrote:
> On Wed, Dec 7, 2011 at 4:01 PM, Xinliang David Li <[email protected]> wrote:
>> Build the test case in the patch file with -finstrument-functions, the
>> link will fail with unsat. The problem is gcc instruments the
>> artificial wrappers that will won't be emitted. The patch fixes the
>> problem. Bootstrap and tested on x86-64/linux.
>>
>
> I think you really should be checking for artificial attribute and not
> looking at always_inline.
Interesting -- I thought I added that. The following is the revised one.
thanks,
David
>
> Thanks,
> Andrew Pinski
Index: gimplify.c
===================================================================
--- gimplify.c (revision 182083)
+++ gimplify.c (working copy)
@@ -8048,6 +8048,13 @@ flag_instrument_functions_exclude_p (tre
return true;
}
+ /* Avoid instrumenting wrapper functions to builtins. */
+
+ if (DECL_ARTIFICIAL (fndecl)
+ && DECL_DISREGARD_INLINE_LIMITS (fndecl)
+ && lookup_attribute ("always_inline", DECL_ATTRIBUTES (fndecl)))
+ return true;
+
return false;
}
Index: testsuite/gcc.target/i386/instrument-func.c
===================================================================
--- testsuite/gcc.target/i386/instrument-func.c (revision 0)
+++ testsuite/gcc.target/i386/instrument-func.c (revision 0)
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+/* { dg-require-effective-target sse } */
+/* { dg-options "-O2 -msse -finstrument-functions" } */
+
+#include <xmmintrin.h>
+
+__attribute__((noinline)) __m128 foo( float *row, int x)
+{
+ __m128 vals = _mm_loadu_ps(row + x);
+ return vals;
+}
+
+int main()
+{
+ float f[10];
+ foo(f, 5);
+ return 0;
+}