On Mon, Nov 7, 2011 at 5:07 PM, Kai Tietz <ktiet...@googlemail.com> wrote: > 2011/11/7 Richard Guenther <richard.guent...@gmail.com>: >> On Sun, Nov 6, 2011 at 11:17 PM, Kai Tietz <kti...@redhat.com> wrote: >>> Hello, >>> >>> the second patch extends the tree-ssa-ifcombine pass so, that it chains up >>> simple if-and/or-if patterns via associative bitwise-and/or operations. >>> This allows for example optimization for cases like: >>> >>> if (c == 0) return 2; >>> if (c == 1) return 2; >>> if (c == 2) return 2; >>> ... >>> >>> as now reassociation-pass can optimize on them. >> >> err ... tree-ssa-ifcombine does exactly if "merging", why are you now >> adding a "merging" part!? The above description does not shed any >> light on this either. In fact the above example is something >> that should be optimized by phiopt. >> >> Richard. > > Well, the example I provided might be not the best, as indeed phiopt > should handle this. But if such if-and/or-if chains have for example > the kind > if (a == 0) > return doo (); > if (a == 1) > return doo (); > > etc. phiopt won't do much here.
tailmerge should change the above to if (a == 0 || a == 1) return doo (); Richard.