On Thu, Mar 15, 2012 at 3:00 PM, Jakub Jelinek <ja...@redhat.com> wrote: > On Thu, Mar 15, 2012 at 02:53:10PM +0100, Kai Tietz wrote: >> > This looks like to match unbound pattern sizes and thus does not fit >> > into the forwprop machinery. Instead it was suggested elsewhere >> > that promoting / demoting registers should be done in a separate pass >> > where you can compute a lattice of used bits and apply a transform >> > based on that lattice and target information (according to PROMOTE_MODE >> > for example). >> >> Well, the integer truncation part might be something for a separate >> pass. It could then also take care that within single-use >> gimple-statements the integral-constant is always on right-hand-side >> of first statement of an +, -, |, ^, &, and mul. >> >> But the cast-hoisting code itself is not unbound AFAICS and has fixed >> pattern size.
Can you split that part out then please? > The type demotion is PR45397/PR47477 among other PRs. > I'd just walk from the narrowing integer conversion stmts recursively > through the def stmts, see if they can be narrowed, note it, and finally if > everything or significant portion of the stmts can be demoted (if not all, > with some narrowing integer conversion stmt inserted), do it all together. For PROMOTE_MODE targets you'd promote but properly mask out constants (to make them cheaper to generate, for example). You'd also take advantate of targets that can do zero/sign-extending loads without extra cost (ISTR that's quite important for some SPEC 2k6 benchmark on x86_64). Richard. > Jakub