https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117282
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2024-10-24 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- >Is it feasible that we rely on this option to peel away conversion losslessly >in this optimization? No because you could do a malloc of a big size. The smallest limit for an example is 39bits addressing on aarch64 (512GB) for the VA space. Othewise, in first case, we have missing a VRP: if (_9 == 0) goto <bb 6>; [11.00%] else goto <bb 3>; [89.00%] <bb 3> [local count: 955630224]: # t_10 = PHI <t_6(3), s_4(D)(2)> t_6 = t_10 + 1; _1 = MEM[(char *)t_6]; if (_1 == 0) goto <bb 4>; [11.00%] else goto <bb 3>; [89.00%] <bb 4> [local count: 105119324]: if (s_4(D) != t_6) goto <bb 5>; [60.08%] else goto <bb 6>; [39.92%] t_6 can never be s_4(D) due to pointer overflowing being undefined. in the second case we could peel off the first iteration of the loop and it would work: ;; basic block 3, loop depth 1, count 1063004408 (estimated locally, freq 15.3607), maybe hot ;; prev block 2, next block 4, flags: (NEW, REACHABLE, VISITED) ;; pred: 4 [98.9% (guessed)] count:993801746 (estimated locally, freq 14.3607) (TRUE_VALUE,EXECUTABLE) ;; 2 [always] count:69202658 (estimated locally, freq 1.0000) (FALLTHRU,EXECUTABLE) # RANGE [irange] unsigned long [0, 9999] # ivtmp.18_19 = PHI <ivtmp.18_18(4), 0(2)> # VUSE <.MEM_8(D)> _3 = MEM[(charD.10 *)s_7(D) + ivtmp.18_19 * 1]; if (_3 == 0) goto <bb 5>; [5.50%] else goto <bb 4>; [94.50%] ;; succ: 5 [5.5% (guessed)] count:58465242 (estimated locally, freq 0.8448) (TRUE_VALUE,EXECUTABLE) ;; 4 [94.5% (guessed)] count:1004539166 (estimated locally, freq 14.5159) (FALSE_VALUE,EXECUTABLE) ;; basic block 4, loop depth 1, count 1004539166 (estimated locally, freq 14.5159), maybe hot ;; prev block 3, next block 5, flags: (NEW, REACHABLE, VISITED) ;; pred: 3 [94.5% (guessed)] count:1004539166 (estimated locally, freq 14.5159) (FALSE_VALUE,EXECUTABLE) # RANGE [irange] unsigned long [1, 10000] ivtmp.18_18 = ivtmp.18_19 + 1; if (ivtmp.18_18 != 10000) goto <bb 3>; [98.93%] else goto <bb 6>; [1.07%] ;; succ: 3 [98.9% (guessed)] count:993801746 (estimated locally, freq 14.3607) (TRUE_VALUE,EXECUTABLE) ;; 6 [1.1% (guessed)] count:10737420 (estimated locally, freq 0.1552) (FALSE_VALUE,EXECUTABLE) So multiple cases. Does this code show up in a benchmark?