[Mesa-dev] Mesa (master): glsl2: Add pass to remove redundant jumps

Ian Romanick idr at freedesktop.org
Mon Sep 13 23:16:40 PDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Luca Barbieri wrote:
> ir_lower_jumps should already do the jump unification, and
> could/should also remove the continue.
> It's probably best to put all jump manipulations there to avoid
> risking rerunning all passes a number of times linear in the program
> size.

I primarily added this pass to remove some of the odd cases that your
new loop unrolling code had.  ir_lower_jumps is already fairly
complicated, and I didn't want to clutter it up.  If ir_lower_jumps is
already doing most of that work, the two passes could be merged.

> Regarding ifs, it would be nice to also remove empty else branches,
> and possibly convert if(c) {} else {code()} to if(!c) {code()} or
> perhaps do the reverse canonicalization instead.
> And also things like "if(c) {if(c) {code()}}" to if(c) {code()}, as
> well as "if(1) {code()}" to "code()", as well as ir_switch -> ir_if
> and viceversa once ir_switch is added.

We could certainly add a pass to do that.  I'm not sure it's necessary.
 I *think* the backend code generator just does the right thing.  It's
worth looking into, though.

> A "cfg simplification" pass might be more appropriate for this though,
> unless it's necessary to add this to ir_lower_jumps to avoid the
> "linear number of optimization runs" problems.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyPE0IACgkQX1gOwKyEAw/BKQCgmhHF8SMdG8XgR/ihPk5xtf1b
y58AnicYrgRp0Xqgh8JNdVe3E767riM8
=RSOw
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list