[gcc r9-9852] ipa-sra: Check also ECF_LOOPING_CONST_OR_PURE when evaluating calls
Martin Jambor
jamborm@gcc.gnu.org
Wed Dec 1 17:30:42 GMT 2021
https://gcc.gnu.org/g:7dd5b92bbe0944dc27e6175b0df72ed0a7188016
commit r9-9852-g7dd5b92bbe0944dc27e6175b0df72ed0a7188016
Author: Martin Jambor <mjambor@suse.cz>
Date: Wed Dec 1 18:29:50 2021 +0100
ipa-sra: Check also ECF_LOOPING_CONST_OR_PURE when evaluating calls
in PR 103267 Honza found out that IPA-SRA does not look at
ECF_LOOPING_CONST_OR_PURE when evaluating if a call can have side
effects. Fixed with this patch. The testcase infinitely loops in a
const function, so it would not make a good addition to the testsuite.
This patch is a manual backport of commit
e5440bc08e07fd491dcccd47e1b86a5985ee117c to the old "early" IPA-SRA.
gcc/ChangeLog:
2021-12-01 Martin Jambor <mjambor@suse.cz>
PR ipa/103267
* tree-sra.c (scan_function): Also check ECF_LOOPING_CONST_OR_PURE
flag.
Diff:
---
gcc/tree-sra.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 909b4fef9a8..252953b7512 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1530,7 +1530,8 @@ scan_function (void)
}
if (final_bbs
- && (flags & (ECF_CONST | ECF_PURE)) == 0)
+ && ((flags & (ECF_CONST | ECF_PURE)) == 0
+ || (flags & ECF_LOOPING_CONST_OR_PURE)))
bitmap_set_bit (final_bbs, bb->index);
}
More information about the Gcc-cvs
mailing list