[Bug rtl-optimization/112525] fail to eliminate unused store
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112525 Jiu Fu Guo changed: What|Removed |Added Resolution|--- |FIXED Status|NEW |RESOLVED --- Comment #8 from Jiu Fu Guo --- Fix committed.
[Bug rtl-optimization/112525] fail to eliminate unused store
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112525 --- Comment #7 from GCC Commits --- The master branch has been updated by Jiu Fu Guo : https://gcc.gnu.org/g:4759383245ac97a5c83c0272f0a831f2a26ea5c1 commit r14-6674-g4759383245ac97a5c83c0272f0a831f2a26ea5c1 Author: Jiufu Guo Date: Tue Dec 19 13:03:06 2023 +0800 treat argp-based mem as frame related in dse The issue mentioned in PR112525 would be able to be handled by updating dse.cc to treat arg_pointer_rtx similarly with frame_pointer_rtx. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30271#c10 also mentioned this idea. And arpg area may be used to pass argument to callee. So, it would be needed to check if call insns are using that mem. PR rtl-optimization/112525 PR target/30271 gcc/ChangeLog: * dse.cc (get_group_info): Add arg_pointer_rtx as frame_related. (check_mem_read_rtx): Add parameter to indicate if it is checking mem for call insn. (scan_insn): Add mem checking on call usage. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr112525.c: New test. * gcc.target/powerpc/pr30271.c: New test.
[Bug rtl-optimization/112525] fail to eliminate unused store
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112525 --- Comment #6 from Jiu Fu Guo --- (In reply to Jiu Fu Guo from comment #3) > One possible method is fixing DSE to let is able to remove those 'store's. > (but need to take care of the case that is using 'arg_pointer' to pass > parameters.) > Some 'store's to the incoming argument area (arg_pointer_rtx) may not safe to be removed: For example: call memset on X86_64 , the insn(s) maybe: 134: [argp+0x8]=r134:SI 135: [argp+0x4]=0x1 136: [argp]=r132:SI 137: ax:SI=call [`memset'] argc:0xc REG_CALL_DECL `memset' REG_EH_REGION 0 insn(s) 134/135/136 can not be removed.
[Bug rtl-optimization/112525] fail to eliminate unused store
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112525 Richard Biener changed: What|Removed |Added Target||powerpc64le --- Comment #5 from Richard Biener --- On x86 calling conventions seem to avoid this issue.
[Bug rtl-optimization/112525] fail to eliminate unused store
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112525 Richard Biener changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed||2023-11-14 --- Comment #4 from Richard Biener --- I wonder if optimizing for "unused" parameters is worth it (usually IPA SRA will elide them). "unused" could be computed by cfgexpand walking the body, but we do expect to be able to inspect those parameters with -g, so care has to be taken that this works at all optimization levels.
[Bug rtl-optimization/112525] fail to eliminate unused store
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112525 --- Comment #3 from Jiu Fu Guo --- One possible method is fixing DSE to let is able to remove those 'store's. (but need to take care of the case that is using 'arg_pointer' to pass parameters.) Another method: there is a patch https://gcc.gnu.org/pipermail/gcc-patches/2023-October/634500.html which introduces lighter-expander-sra (this patch is only for struct parameter now). We may enhance this patch to avoid storing the unused parameters.
[Bug rtl-optimization/112525] fail to eliminate unused store
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112525 Andrew Pinski changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill ||a/show_bug.cgi?id=30271, ||https://gcc.gnu.org/bugzill ||a/show_bug.cgi?id=39102 --- Comment #2 from Andrew Pinski --- And more
[Bug rtl-optimization/112525] fail to eliminate unused store
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112525 --- Comment #1 from Jiu Fu Guo --- (In reply to Jiu Fu Guo from comment #0) > For below code: > ``` > typedef struct teststruct > { > double d; > int arr[15]; /* for ppc64le example foo1, 14: foo is just blr. 15: foo has > 8 'std's */ > } teststruct; Here, if the code is "int arr[14];", the struct is just passed via registers (in foo function); and in the expander pass, they are stored to frame area. If the code is "int arr[15];", the struct is passed through registers partially, and the other partial is through memory; and in the expander pass, they are stored to the area which is pointed via arg pointer. In DSE pass, the 'dead' stores to 'frame' can be eliminated.