On 30/09/14 17:45, Jeff Law wrote: > On 09/30/14 08:15, Richard Earnshaw wrote: >> >> I think part of the problem is in the naming of single_set(). From the >> name it's not entirely obvious to users that this includes insns that >> clobber registers or which write other registers that are unused after >> that point. I've previously had to fix a bug where this assumption was >> made (eg https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54300) >> >> Most uses of single_set prior to register allocation are probably safe; >> but later uses are fraught with potential problems of this nature and >> may well be bugs waiting to happen. > Very possibly. There's a bit of a natural tension here in that often we > don't much care about the additional CLOBBERS, but when we get it wrong, > obviously it's bad. > > I haven't done any research, but I suspect the change it ignore clobbers > in single_set came in as part of exposing the CC register and avoiding > regressions all over the place as a result.
It's not just clobbers; it ignores patterns like (parallel [(set (a) (...) (set (b) (...)]) [(reg_note (reg_unused(b))] Which is probably fine before register allocation but definitely something you have to think about afterwards. > > I wonder what would happen if we ignored prior to register allocation, > then rejected insns with those CLOBBERs once register allocation started. > Might work; but it might miss some useful cases as well... R.