From 83ecbc042ff3a1cd788abe84fd16fa0e507714b2 Mon Sep 17 00:00:00 2001 From: Erick Ochoa Date: Mon, 9 Mar 2020 14:08:09 +0100 Subject: Adds test to determine if parameter types escape --- .../ipa/ipa-ea-09-parameter-type-escapes-0.c | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/ipa/ipa-ea-09-parameter-type-escapes-0.c diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-ea-09-parameter-type-escapes-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-ea-09-parameter-type-escapes-0.c new file mode 100644 index 00000000000..70c8c1f248d --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/ipa-ea-09-parameter-type-escapes-0.c @@ -0,0 +1,25 @@ +/* { dg-do link } */ +/* { dg-options "-flto -fipa-hello-world -fdump-ipa-hello-world" } */ + +#include + +struct astruct_s { _Bool a; _Bool b; _Bool c;}; +struct astruct_s astruct; // This should not escape +struct bstruct_s { _Bool a; _Bool b; _Bool c;}; +struct bstruct_s bstruct; // This should not escape + +// This will make astruct_s escape +__attribute__((externally_visible)) void escaping(struct astruct_s cstruct) {} +void non_escaping(struct bstruct_s dstruct) {} + +int main() +{ + astruct.a = 0; + bstruct.b = 0; +} + + +/* { dg-final { scan-wpa-ipa-dump "collected,astruct_s" "hello-world" } } */ +/* { dg-final { scan-wpa-ipa-dump "type astruct_s is escaping true" "hello-world" } } */ +/* { dg-final { scan-wpa-ipa-dump "collected,bstruct_s" "hello-world" } } */ +/* { dg-final { scan-wpa-ipa-dump "type bstruct_s is escaping false" "hello-world" } } */ -- cgit v1.2.3