> On 3/31/20 2:29 PM, Jan Hubicka wrote: > > Well, I basically went through all pointers and tried to get rid of as > > many of them as possible. CONTEXT pointers do increase size of SCCs > > that increases chance they will not get merged and also processing time > > of merging algorithm. I guess if we need to stream more contexts we > > could do that (and check the effect on merging and average SCC size) > > Ok, do we want to stream contexts just for the new/delete operators? > Can you please prepare a streaming patch? Hi, I am still not convinced that context is useful here. It took me a while to understand what the code does and why it fails, but here is a testcase. It fails for me with your patch and -O2 --param early-inlining-insns=100
The invalid transform is to remove pair base:new and B:delete B:new gets inlined and we get count out of sync. Honza #include <stdio.h> volatile int idx; struct base { __attribute__((malloc,noinline)) static void* operator new(unsigned long sz) { return ::operator new(sz); } __attribute__((malloc,noinline)) static void operator delete(void* ptr) { --count[idx]; ::operator delete(ptr); } volatile static int count[2]; }; volatile int base::count[2] = {0,0}; struct B:base { static void* operator new(unsigned long sz) { ++count[idx]; return base::operator new(sz); } }; volatile int c=1; int main(){ for (int i; i<c;i++) { idx=0; delete new B; if (B::count[0] != 0) __builtin_abort (); } return 0; }