-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 11/07/11 09:24, Richard Guenther wrote: > On Mon, Nov 7, 2011 at 5:07 PM, Jeff Law <l...@redhat.com> wrote: > >>>> >>>> I also wonder if instead of a new pass control-dependent DCE >>>> can be taught of this? > It could. I'm not sure it really buys us anything except maybe > being able to reuse the pdom & control-dependency analysis. > > It actually more naturally belongs in cprop because it's cprop > that exposes NULL pointers in useful ways (in memory dereferences > and as PHI args). > >> Heh, indeed, that as well. I suppose every pass that handles >> unexecutable edges in some way might benefit from this. Like >> for > >> if (i) j_1 = 1; else { j_2 = 2; *0 = ...; } j_3 = PHI <j_1, j_2> > >> we could CCP j_1 = 1 to j_3 ... Yea, but we already do that... We'd propagate the constant 1 into the PHI. DOM, CCP and probably VRP all do this..
> >> Even without actually removing the edge and the trapping stmt. I'm guessing you mean we could propagate j_1's value to the uses of j_3. This is true, but misses the primary effect of the patch, namely to remove the controlling conditional branch which leads to the *0 (if (i)) in your sample. Those controlling conditions *are* executed at runtime and we want to remove them if at all possible. Once that's done all the things you'd expect/want to happen do so naturally with the existing optimizers. > >> For DCE the most interesting part would be to end the block at >> the point of the trap - thus - replace the store with a >> __builtin_trap () which then trivially makes all code w/o >> side-effects on the path dead. But we're still stuck with the conditional leading to the path with the __builtin_trap. That's what we want to avoid since those conditionals are executed at runtime. Jeff -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJOuCltAAoJEBRtltQi2kC7acEIAJXOaJt0jZIuKS5ZsxrvADGO TVqT0tosqOvm9EkOsZve72WSZ1fQpklbdbuNwUPvxhb60Z4Q+a2C/kKbxq1PeJs5 Ba/lj2R8Na9mg9Nps/bDnDVvuOATk59IhyoEjnZlUMMkVYZS1LOgTcdPvc1ItbhQ D+0SxaDfBPLLJ1zHcOJ2jXnF+MDFq1We5yZG2czOOYWup9zbCpmkrNzN/MisxAeU W8PT48VHTD/Ez6zOCswVtvkmLUhOWEcSG5Um2dt90RF5K8gSigzgeFO2wal+uJe5 YpY9IPrK0OK2tCXjGQulaGKhylyN6ynEwCdHJYQua1g1Q7I7rxBxJ/oMMcxw9zE= =Dd+Z -----END PGP SIGNATURE-----