https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86892
Bug ID: 86892 Summary: RTL CSE commoning trivial constants across call and/or too early Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pthaugen at gcc dot gnu.org CC: dje at gcc dot gnu.org, jakub at gcc dot gnu.org, rsandifo at gcc dot gnu.org, segher at gcc dot gnu.org, wschmidt at gcc dot gnu.org Target Milestone: --- Host: powerpc64le-unknown-linux-gnu Target: powerpc64le-unknown-linux-gnu Build: powerpc64le-unknown-linux-gnu For the following testcase cse.c will common the constant 0 across the call which then requires the use of a non-volatile register (and prologue/epilogue save/restore). void bar(); int a, b; void foo() { a = 0; bar(); b = 0; } I have also observed a situation where early cse of a constant prevented some combine transformations from occurring because the register's lifetime had been extended. The feeling is that cse of trivial constants should not be done so early in the pass schedule and should not be done across calls at all.