[llvm-dev] Multi-Threading Compilers

Chris Lattner via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 27 20:31:12 PDT 2020



> On Mar 27, 2020, at 1:55 PM, David Blaikie <dblaikie at gmail.com> wrote:
> 
> That's why I'm also wary of the idea of just having use lists empty
> for certain types without any other special handling. However, I would
> argue that if Value::use_begin() etc. contain an assertion that fails
> when called on one of the value types that don't have use lists, then
> the Liskov substition principle is de facto not broken. It basically
> leads to a situation that is as-if Value didn't have use lists in the
> first place, and only certain sub-types had use lists.
> 
> But it doesn't - it means you write some generic code, test it with some cases & looks like it generalizes to other cases (you don't want to/can't test generic code with all possible generic arguments - that's why substitutability is important) then the code breaks when it hits a constant Value because it doesn't conform to the contract.

David is exactly right.  To say the same thing in another way, such a design point would break library based design, one of the core principles of LLVM that makes it so powerful.  

To make this explicit, a library that walks use-lists internally would have implicit dependencies in its APIs that some things are not allowed to be constants.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200327/6388aca4/attachment.html>


More information about the llvm-dev mailing list