From: Martin Jambor Date: Tue, 30 Nov 2021 17:45:11 +0000 (+0100) Subject: ipa-sra: Check also ECF_LOOPING_CONST_OR_PURE when evaluating calls X-Git-Tag: basepoints/gcc-13~2680 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5440bc08e07fd491dcccd47e1b86a5985ee117c;p=thirdparty%2Fgcc.git 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 PR ipa/103267 * ipa-sra.c (scan_function): Also check ECF_LOOPING_CONST_OR_PURE flag. --- diff --git a/gcc/ipa-sra.c b/gcc/ipa-sra.c index cb0e30507a1d..12ccd0495520 100644 --- a/gcc/ipa-sra.c +++ b/gcc/ipa-sra.c @@ -1925,7 +1925,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;