https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113796
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=110252 Target Milestone|--- |14.0 Summary|[14] RISC-V rv64gcv vector: |[14 Regression] RISC-V |Runtime mismatch at -O2 |rv64gcv vector: Runtime | |mismatch at -O2 CC| |pinskia at gcc dot gnu.org Component|target |tree-optimization Last reconfirmed| |2024-02-07 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed, the issue is in ifcvt. Before ifcvt we had: ``` if (_1 >= 0) goto <bb 5>; [59.00%] else goto <bb 6>; [41.00%] <bb 5> [local count: 563821836]: iftmp.1_9 = _1 >> 6; <bb 6> [local count: 955630226]: # iftmp.1_5 = PHI <iftmp.1_9(5), 1(4)> ``` Which is fine. Note the range for _1 is: ``` # RANGE [irange] signed char [0, 1] iftmp.1_9 = _1 >> 6; ``` After ifcvt we get: ``` iftmp.1_9 = _1 >> 6; _25 = _1 < 0; _4 = (signed charD.14) _25; # RANGE [irange] signed char [0, 1] iftmp.1_5 = _4 | iftmp.1_9; ``` Which is incorrect. ifcvt needs to something similar to what phiopt did in r14-2650-g8c79b49cd4fa74 .