[llvm-dev] [MachineScheduler]: SchedBoundary trivially copiable, but "HazardRec" is raw pointer: a design issue?

Lorenzo Casalino via llvm-dev llvm-dev at lists.llvm.org
Sun Oct 6 12:50:52 PDT 2019


> If you do want to copy the scheduling state, don’t you also need to copy the hazard recognizer object? In that case, HazardRec should probably be a unique_ptr AND SchedBoundary's copy constructor needs to copy the hazard recognizer.
You are definitely right.
>
> I’m a *little* worried about encouraging developers to copy the scheduling state because it seems like an easy way introduce inefficiency. But maybe comments telling devs not to do this without being careful would be sufficient.
>
> -Andy

I share the same concern. Indeed, I'd prefer to prevent the trivial
copy, and insert a more efficient mechanism.

Actually, for my personal project, I'm working on a small design to make
copy-state efficient. May it be
of any interest?

Meanwhile, I'd issue a patch with the HazardRec object wrapper in a
unique_ptr and SchedBoundary with non-default
copy-constructor.


Thank you, Andrew

-- Lorenzo




More information about the llvm-dev mailing list