On Fri, Sep 10, 2021 at 04:27:05PM +0200, nsaenzju@xxxxxxxxxx wrote: > My understanding is that can only happen when the expression to right of 'a' > has no dependencies with t2. And at that stage, do we really care? Well, yes, > for example if you're measuring how long it took to assign a, which is similar > to what we do: > > workload_fn workload = g.workload->w_fn; > frc(&t1) > workload() > frc(&t2) > > But in that case the compiler is forced to handle the indirect function call > and IIUC there is little optimization todo, so we're safe without barriers. Yep. > > That said, I don't feel overly confident about all this, and there is little > downside to the compiler barriers, so I'll just add them. Yep, too. IMHO that's the point (even I know it's trivial and I'm harsh :-D) - we don't have a reason to drop it if it helps us to make sure there's no surprise. Thanks, -- Peter Xu