[Bug rtl-optimization/98973] [11 regression] Wrong code with gcse store motion pass
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98973 --- Comment #12 from Jeffrey A. Law --- IIRC LSM is quite restricted in the types of MEM expressions it will optimize. In particular I think they have to be SYMBOL_REFs which severely limits LSM's effectiveness. I would support removing it given that it's not enabled by default anywhere and is of limited utility.
[Bug rtl-optimization/98973] [11 regression] Wrong code with gcse store motion pass
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98973 Eric Botcazou changed: What|Removed |Added Status|NEW |WAITING --- Comment #11 from Eric Botcazou --- I don't seem to be able to reproduce with a cross. Can you post the configure line for the compiler?
[Bug rtl-optimization/98973] [11 regression] Wrong code with gcse store motion pass
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98973 Richard Biener changed: What|Removed |Added CC||ebotcazou at gcc dot gnu.org, ||law at gcc dot gnu.org, ||stevenb.gcc at gmail dot com Status|UNCONFIRMED |NEW Priority|P3 |P2 Ever confirmed|0 |1 Last reconfirmed||2021-04-09 --- Comment #10 from Richard Biener --- Confirmed. P2 because it's surely latent and nobody seems interested in maintaining store-motion (which I think could morph into a more general sinking facility on RTL). I'm not even sure who knows the original gcse code well (it was split up by Steven).
[Bug rtl-optimization/98973] [11 regression] Wrong code with gcse store motion pass
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98973 --- Comment #9 from Richard Biener --- Btw, this is likely a latent issue, the store-motion code didn't change since ages and the bisected rev. likely just changed the input to the pass. So the dump difference is -(note 76 75 217 19 [bb 19] NOTE_INSN_BASIC_BLOCK) -(insn 217 76 78 19 (set (reg:SI 3 %r3 [133]) -(reg:SI 2 %r2 [orig:69 ivtmp.24+4 ] [69])) "t.c":11:19 1467 {*movsi_zarch} - (nil)) -(insn 78 217 218 19 (parallel [ -(set (reg:SI 3 %r3 [133]) -(plus:SI (reg:SI 3 %r3 [133]) -(const_int -1 [0x]))) -(clobber (reg:CC 33 %cc)) -]) "t.c":11:19 1821 {*addsi3} - (nil)) -(insn 218 78 79 19 (set (mem/c:SI (reg/f:DI 8 %r8 [103]) [1 c+0 S4 A32]) -(reg:SI 3 %r3 [133])) "t.c":11:19 1467 {*movsi_zarch} - (nil)) -(insn 79 218 83 19 (parallel [ -(set (reg:DI 2 %r2 [orig:69 ivtmp.24 ] [69]) -(plus:DI (reg:DI 2 %r2 [orig:69 ivtmp.24 ] [69]) +(note 76 75 79 19 [bb 19] NOTE_INSN_BASIC_BLOCK) +(insn 79 76 83 19 (parallel [ +(set (reg:DI 3 %r3 [orig:69 ivtmp.24 ] [69]) +(plus:DI (reg:DI 3 %r3 [orig:69 ivtmp.24 ] [69]) (const_int -1 [0x]))) (clobber (reg:CC 33 %cc)) ]) "t.c":11:12 1820 {*adddi3} (nil)) (insn 83 79 84 19 (set (reg:CCS 33 %cc) -(compare:CCS (reg:SI 2 %r2 [orig:69 ivtmp.24+4 ] [69]) +(compare:CCS (reg:SI 3 %r3 [orig:69 ivtmp.24+4 ] [69]) (const_int 2 [0x2]))) "t.c":11:12 1415 {*cmpsi_ccs} where you can see that %r2 is no longer decremented but the store (sunk) after the loop still uses %r2: (insn 175 105 218 23 (set (mem/c:SI (reg/f:DI 8 %r8 [103]) [1 c+0 S4 A32]) (reg:SI 2 %r2 [orig:110 c ] [110])) 1467 {*movsi_zarch} (nil)) -- scanning new insn with uid = 175. STORE_MOTION insert store at start of BB 26: (insn 175 105 0 26 (set (mem/c:SI (reg/f:DI 103) [1 c+0 S4 A32]) (reg:SI 110 [ c ])) -1 (nil)) I'll note the gcse dumps are after RA but the store-motion dump is pre-RA.
[Bug rtl-optimization/98973] [11 regression] Wrong code with gcse store motion pass
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98973 --- Comment #8 from Richard Biener --- (In reply to Richard Biener from comment #6) > Btw, -fgcse-sm is nowhere enabled by default (same applies to -fgcse-las), > we should consider removing these optimizations (though -fgcse-las at least > sounds > useful and I wonder why it is not enabled). GCSE store-motion should be > re-implemented on GIMPLE, replacing the sink pass (there were previous > attempts in implementing SSU-PRE). > > A comment in store-motion.c claims > > /* This pass implements downward store motion. >As of May 1, 2009, the pass is not enabled by default on any target, >but bootstrap completes on ia64 and x86_64 with the pass enabled. */ > > I'm trying if enabling it by default still bootstraps & tests OK on x86-64 > (also enabling gcse-las at the same time..) It does. Extra FAILs are FAIL: c-c++-common/guality/Og-dce-2.c -Og line 17 ptr->a == 1 FAIL: c-c++-common/guality/Og-dce-2.c -Og -flto line 17 ptr->a == 1
[Bug rtl-optimization/98973] [11 regression] Wrong code with gcse store motion pass
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98973 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #7 from Jakub Jelinek --- Started with r11-4122-g06729598b0dc10dbe60545f21c2214ad66a5a3db
[Bug rtl-optimization/98973] [11 regression] Wrong code with gcse store motion pass
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98973 --- Comment #6 from Richard Biener --- Btw, -fgcse-sm is nowhere enabled by default (same applies to -fgcse-las), we should consider removing these optimizations (though -fgcse-las at least sounds useful and I wonder why it is not enabled). GCSE store-motion should be re-implemented on GIMPLE, replacing the sink pass (there were previous attempts in implementing SSU-PRE). A comment in store-motion.c claims /* This pass implements downward store motion. As of May 1, 2009, the pass is not enabled by default on any target, but bootstrap completes on ia64 and x86_64 with the pass enabled. */ I'm trying if enabling it by default still bootstraps & tests OK on x86-64 (also enabling gcse-las at the same time..)
[Bug rtl-optimization/98973] [11 regression] Wrong code with gcse store motion pass
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98973 --- Comment #5 from Andreas Krebbel --- Created attachment 50132 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50132&action=edit RTL dump from store motion pass
[Bug rtl-optimization/98973] [11 regression] Wrong code with gcse store motion pass
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98973 --- Comment #4 from Andreas Krebbel --- The update of global variable c is moved out of the loop. Due to that c stays at 8 although it should be counted down to 2.
[Bug rtl-optimization/98973] [11 regression] Wrong code with gcse store motion pass
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98973 --- Comment #3 from Andreas Krebbel --- Created attachment 50131 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50131&action=edit RTL GCSE dump without -fgcse-sm
[Bug rtl-optimization/98973] [11 regression] Wrong code with gcse store motion pass
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98973 --- Comment #2 from Andreas Krebbel --- Created attachment 50130 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50130&action=edit RTL GCSE dump with -fgcse-sm
[Bug rtl-optimization/98973] [11 regression] Wrong code with gcse store motion pass
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98973 Richard Biener changed: What|Removed |Added Known to fail||11.0 Keywords||wrong-code Target Milestone|--- |11.0 Known to work||10.2.1 --- Comment #1 from Richard Biener --- works on x86_64. Can you point out the bogus transform done by GCSE?