On Thu, Jul 04, 2019 at 10:40:15AM -0700, Paul E. McKenney wrote: > > I think fully guaranteeing this is hard (besides when you use > > volatile), we have the very same issue when dealing with > > pointer provenance rules, known for years and not fixed > > (and I don't see a good way to fix these issues without > > sacrifying performance everywhere). > > > > Good luck ;) > > Thank you, we will need it! ;-)
Well, luck probably isn't all you need, you'll need some way to represent those dependencies in the IL (both GIMPLE and RTL) that would ensure that they aren't optimized away, because just hoping that optimization don't mess that up or just patching a few optimizations you discover first isn't going to be very reliable. Say don't rewrite those into SSA form and represent them close to how volatile ptrs are handled at least for the beginning, and if there are safe optimizations special case those, rather than allowing all optimizations on those and hope it will work out. Jakub