On Mon, 2020-05-18 at 19:59 +0200, Aldy Hernandez wrote: > Howdy. > > The main evrp domwalker seems cut and pasted from the > substitute_and_fold_engine (or was it the other way around?). Albeit, > there are a few things that evrp does, like set up ranges, but these can > be set up with virtuals, and thus provide a general repository to do all > things subst & fold, which I think was the main idea. > > You will notice that the resulting evrp code becomes a handful of lines > calling evrp_analyze to set up ranges. > > We've been playing with this approach on the ranger branch, and have > been able to use it to implement ranger-vrp in 24 lines, all while > sharing all the evrp folding code. Granted, the ranger also needs > access to vr_values::simplify_using_ranges* which I have abstracted into > an independent class and will post as a follow-up. > > Also, for future-proofing, I have added a gimple statement argument to > get_value(). This provides context where a future ranger (evrp, VRP, > ranger, whatever) can provide better values depending on the statement > we are processing. > > OK for mainline? > > Aldy
> commit f90d4a08986e98cbcb827665d91759488c714075 > Author: Aldy Hernandez <al...@redhat.com> > Date: Tue May 5 13:45:39 2020 +0200 > > Merge evrp uses of substitute_and_fold_engine into the engine itself. > > This patch merges the evrp uses of the substitute and fold engine into > the engine itself, at least the parts that can be re-used by other > engine uses. It also adds a context parameter to get_value() for > further use. SO what's interesting here is originally the dominator walker had methods that probably would have made this simpler. We ultimately took them out because they didn't really help all that much in the existing users of the dominator walker and they just slowed things down with per-statement virtual calls in both the into-ssa and DOM passes. Anyway, this is fine with me. I suspect there's further cleanups we can and should do, but the removal of duplicated code along makes your patch worth it IMHO. jeff >