https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110377
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> --- (In reply to Jan Hubicka from comment #0) > In the following testcase > void test2(int); > void > test(int n) > { > if (n > 5) > __builtin_unreachable (); > test2(n); > } > we should work out that value range of n passed to test2 is [INT_MIN,4]. > This would help optimizing some code in libstdc++, which now uses similar > constructs to ensure known value ranges. Ranger does already know this at the call site (this is output from what it know during EVRP for instance): =========== BB 4 ============ n_1(D) [irange] int [-INF, 5] <bb 4> : test2 (n_1(D)); return; All you need to do is either query a ranger during processing of the parameter, or tag the parameter on the call at some point.. It would be far more effective than trying to use global ranges to communicate the information. I had always presumed we would eventually get to the place where we can use context sensitive range information at each call site during IPA analysis. And that likewise, we'd communicate back at call sites what the return range might be when available. (That would be a range query at the return locations of the value on the return)