[gcc r11-9347] ipa-sra: Check also ECF_LOOPING_CONST_OR_PURE when evaluating calls
Martin Jambor
jamborm@gcc.gnu.org
Wed Dec 1 13:24:12 GMT 2021
https://gcc.gnu.org/g:5e2e6cc84c46ff7ceb6395c0309a2c6b71d83cb1
commit r11-9347-g5e2e6cc84c46ff7ceb6395c0309a2c6b71d83cb1
Author: Martin Jambor <mjambor@suse.cz>
Date: Wed Dec 1 14:13:35 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.
gcc/ChangeLog:
2021-11-29 Martin Jambor <mjambor@suse.cz>
PR ipa/103267
* ipa-sra.c (scan_function): Also check ECF_LOOPING_CONST_OR_PURE flag.
(cherry picked from commit e5440bc08e07fd491dcccd47e1b86a5985ee117c)
Diff:
---
gcc/ipa-sra.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/ipa-sra.c b/gcc/ipa-sra.c
index 6cde066b7dc..bbdb4cbfd1d 100644
--- a/gcc/ipa-sra.c
+++ b/gcc/ipa-sra.c
@@ -1931,7 +1931,8 @@ scan_function (cgraph_node *node, struct function *fun)
if (lhs)
scan_expr_access (lhs, stmt, ISRA_CTX_STORE, bb);
int flags = gimple_call_flags (stmt);
- if ((flags & (ECF_CONST | ECF_PURE)) == 0)
+ if (((flags & (ECF_CONST | ECF_PURE)) == 0)
+ || (flags & ECF_LOOPING_CONST_OR_PURE))
bitmap_set_bit (final_bbs, bb->index);
}
break;
More information about the Gcc-cvs
mailing list