[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 --- Comment #16 from Jakub Jelinek --- Actually, there is no need to use the __COUNTER__ stuff, just use static const int __ia64_asr_p = ...; in the scope. It is just important __OPTIMIZE__ is on, because at -O0 the compiler wouldn't optimize

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-11 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 --- Comment #15 from Jakub Jelinek --- (In reply to Matthew Wilcox from comment #14) > Confirmed this fixes the problem. I'll send it to Tony and see if he likes > it. May I add your Signed-off-by to the patch? Sure. Feel free to reformat it

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-11 Thread matthew at wil dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 --- Comment #14 from Matthew Wilcox --- Confirmed this fixes the problem. I'll send it to Tony and see if he likes it. May I add your Signed-off-by to the patch?

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-11 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-11 Thread aldyh at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 --- Comment #12 from Aldy Hernandez --- (In reply to Matthew Wilcox from comment #9) > Maybe I'm a little slow, but I don't see what the path is that sets 'nr' to > 0. It's 1UL << compound_order. Typically, compound_order is 0, although it >

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-11 Thread matthew at wil dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 --- Comment #11 from Matthew Wilcox --- I'm sorry, I still don't get it. What I think you're saying is that GCC performs this optimisation: nr = 1UL << compound_order(page); atomic_sub_return(x, nr); into: if (PageHead(page))

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-11 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 Jeffrey A. Law changed: What|Removed |Added Status|WAITING |RESOLVED CC|

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-11 Thread matthew at wil dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 --- Comment #9 from Matthew Wilcox --- Maybe I'm a little slow, but I don't see what the path is that sets 'nr' to 0. It's 1UL << compound_order. Typically, compound_order is 0, although it may be anything up to log2(number of pages in the

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-11 Thread aldyh at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 --- Comment #8 from Aldy Hernandez --- Ah, I see what the problem is. unsigned long i, nr = 1UL << compound_order(page); ... page_ref_sub(page, nr); // calls __builtin_constant_p(nr) eventually The problem is that there is a path to

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-11 Thread matthew at wil dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 --- Comment #7 from Matthew Wilcox --- OK, so how should we write this function/macro to accomplish what we want? And the requirement is "If the argument is one of these eight special constants, use this special instruction, otherwise call this

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-11 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 --- Comment #6 from rguenther at suse dot de --- On Thu, 11 Jan 2018, matthew at wil dot cx wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 > > --- Comment #5 from Matthew Wilcox --- > Hi Aldy! > > Thanks for looking into this.

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-10 Thread matthew at wil dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 --- Comment #5 from Matthew Wilcox --- Hi Aldy! Thanks for looking into this. Yes, I agree, there's no way that GCC can know this is a constant, but that *should* have been taken care of. Please pardon me copying and pasting from the original

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-10 Thread aldyh at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 Aldy Hernandez changed: What|Removed |Added Status|UNCONFIRMED |WAITING Last reconfirmed|

[Bug middle-end/83653] [6/7/8 Regression] GCC fails to remove a can't-happen call on ia64

2018-01-08 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83653 Richard Biener changed: What|Removed |Added Summary|[6 Regression] GCC fails to |[6/7/8 Regression] GCC