Fix tree-optimization/101941: IPA splitting out function with error attribute
authorAndrew Pinski <apinski@marvell.com>
Wed, 17 Nov 2021 02:45:22 +0000 (02:45 +0000)
committerAndrew Pinski <apinski@marvell.com>
Tue, 18 Jan 2022 10:35:48 +0000 (02:35 -0800)
commit76fe494230477a69f8fa8c8ca2d493acaf343eb1
tree9c56a55724928ee67880ac8ea95951af26b21604
parent8f6b62e0f0c99e421d07bf1847259744db22924b
Fix tree-optimization/101941: IPA splitting out function with error attribute

The Linux kernel started to fail compile when the jump threader was improved
(r12-2591-g2e96b5f14e4025691). This failure was due to the IPA splitting code
decided now to split off the basic block which contained two functions,
one of those functions included the error attribute on them.  This patch fixes
the problem by disallowing basic blocks from being split which contain functions
that have either the error or warning attribute on them.

The two new testcases are to make sure we still split the function for other
places if we reject the one case.

Committed as approved after Bootstrapped and tested on x86_64-linux-gnu with no regressions.

PR tree-optimization/101941

gcc/ChangeLog:

* ipa-split.cc (visit_bb): Disallow function calls where
the function has either error or warning attribute.

gcc/testsuite/ChangeLog:

* gcc.c-torture/compile/pr101941-1.c: New test.
* gcc.dg/tree-ssa/pr101941-1.c: New test.
gcc/ipa-split.cc
gcc/testsuite/gcc.c-torture/compile/pr101941-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr101941-1.c [new file with mode: 0644]