From f8ebfae25297def77ebdb2baaf65f6c9079b67f4 Mon Sep 17 00:00:00 2001 From: Erick Ochoa Date: Mon, 9 Mar 2020 14:01:39 +0100 Subject: Finds escaping parameters --- .../gcc.dg/ipa/ipa-ea-08-parameter-escapes-0.c | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/ipa/ipa-ea-08-parameter-escapes-0.c (limited to 'gcc/testsuite/gcc.dg/ipa/ipa-ea-08-parameter-escapes-0.c') diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-ea-08-parameter-escapes-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-ea-08-parameter-escapes-0.c new file mode 100644 index 00000000000..e4c78d3abd3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/ipa-ea-08-parameter-escapes-0.c @@ -0,0 +1,28 @@ +/* { dg-do link } */ +/* { dg-options "-flto -fipa-hello-world -fdump-ipa-hello-world" } */ +/* { dg-require-effective-target lto } */ + + +#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 + +__attribute__((externally_visible)) void escaping(struct astruct_s cstruct) {} +void non_escaping(struct astruct_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 "variable bstruct is escaping false" "hello-world" } } */ +/* { dg-final { scan-wpa-ipa-dump "collected,bstruct_s" "hello-world" } } */ +/* { dg-final { scan-wpa-ipa-dump "variable astruct is escaping false" "hello-world" } } */ +/* { dg-final { scan-wpa-ipa-dump "variable cstruct is escaping true" "hello-world" } } */ +/* { dg-final { scan-wpa-ipa-dump "variable dstruct is escaping false" "hello-world" } } */ -- cgit v1.2.3