https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96351
Andrew Macleod <amacleod at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amacleod at redhat dot com --- Comment #2 from Andrew Macleod <amacleod at redhat dot com> --- I had to do some tweaking and manually inline it, but eventually I managed to get: <bb 4> : pszTmp_11 = str_8(D) + 2; goto <bb 6>; [INV] <bb 5> : pszTmp_13 = pszTmp_5 + 2; <bb 6> : # pszTmp_5 = PHI <pszTmp_11(4), pszTmp_13(5)> _1 = *pszTmp_5; if (_1 != 0) goto <bb 5>; [INV] else goto <bb 7>; [INV] <bb 7> : # pszTmp_16 = PHI <pszTmp_5(6)> _2 = pszTmp_16 - str_8(D); _3 = _2 /[ex] 2; len_12 = (unsigned int) _3; <bb 8> : # len_4 = PHI <0(2), len_12(7), 0(3)> if (len_4 == 0) goto <bb 9>; [INV] else goto <bb 10>; [INV] Nothing we can do right now. Its possible that the relational work in the next release *might* be able to sort something out, but thats probably down the road. We'll be able to record that a) pszTmp_11 > str_8(D) b) pszTmp_13 > pszTmp_5 c) when we see # pszTmp_5 = PHI <pszTmp_11(4), pszTmp_13(5)> we might possibly be able to deduce that d) pszTmp_5 > str_8(D), which then leads to e) pszTmp_16 > str_8(D). which means we could know that _2 > 0. The tricky bit will be knowing that not only is _2 > 0, but its actually [2, +INF]. Initial plans for relations are not to track possible offsets, but it could be follow up work. If we can know that, then we'd be able to calculate len_12 = [1, +INF/2]. With a non-zero range for len_12, then it would be possible for the threader to create 2 execution paths.. the zero and the non-zero path. on the non-zero path , there would no longer need to be a reference to len_12, and dead code could conceivably eliminate the enter else block. I'd keep this around as a reference, but I don't see this happening any time soon. If the threaders get a revamp next year... then maybe!