> On Mar 25, 2020, at 12:52 AM, Doerfert, Johannes <jdoerfert at anl.gov> wrote: > > > Some random thoughts: > > If no pass ever walks the use list of a constant, except globals which > we could handle differently, we could get rid of their use-list or > overwrite their use-list interface functions to make them no-ops.This would be really problematic because it breaks orthogonality in the compiler. Today, you can walk the use-list of any operand to an instruction. This would be broken by this change, which would make it much easier to write buggy/incorrect compiler code and passes. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200325/3d08c954/attachment-0001.html>
Doerfert, Johannes via llvm-dev
2020-Mar-25 23:14 UTC
[llvm-dev] Multi-Threading Compilers
On 3/25/20 3:23 PM, Chris Lattner wrote: > > >> On Mar 25, 2020, at 12:52 AM, Doerfert, Johannes <jdoerfert at anl.gov> wrote: >> >> >> Some random thoughts: >> >> If no pass ever walks the use list of a constant, except globals which >> we could handle differently, we could get rid of their use-list or >> overwrite their use-list interface functions to make them no-ops. > > This would be really problematic because it breaks orthogonality in > the compiler. I doubt it is as simple as that and I we should differentiate more before we make blanked statements. > Today, you can walk the use-list of any operand to an instruction. > This would be broken by this change, First, you would be able to walk the use-list of any operand. So nothing breaks just yet. > which would make it much easier to write buggy/incorrect compiler code > and passes. I argued (implicitly) above that the uses of a Constant[Int/Float/...] are really not interesting if no-one ever walks them. Let's assume you walk the uses and we "removed" the use list so there are none, what does that mean. I'd say, nothing much. If you inspect the Value and see it's a Constant you have to assume it has Aliases that denote the same value so direct uses are not really interesting anyway. If you inspect further and see ConstantInt/Float/... you can deal with the missing use list. If you don't inspect the Value you cannot really make much of an empty use list, or can you? I doubt we ever call RAUW on a ConstantInt/Float/... Feel free to elaborate on your concerns. Thanks, Johannes > -Chris > >
On Mar 25, 2020, at 4:14 PM, Doerfert, Johannes <jdoerfert at anl.gov> wrote:> >> Today, you can walk the use-list of any operand to an instruction. >> This would be broken by this change, > > First, you would be able to walk the use-list of any operand. So nothing > breaks just yet.If I understand correctly, you are suggesting that you can walk it, but you don’t get all the uses. This is extremely dangerous, it would be better to abort.>> which would make it much easier to write buggy/incorrect compiler code >> and passes. > > I argued (implicitly) above that the uses of a Constant[Int/Float/...] > are really not interesting if no-one ever walks them.There is a difference between “no one ever walks them in practice” and “no one can walk them. :-)> Let's assume you > walk the uses and we "removed" the use list so there are none, what does > that mean. I'd say, nothing much. If you inspect the Value and see it's > a Constant you have to assume it has Aliases that denote the same value > so direct uses are not really interesting anyway. If you inspect further > and see ConstantInt/Float/... you can deal with the missing use list. If > you don't inspect the Value you cannot really make much of an empty use > list, or can you? I doubt we ever call RAUW on a ConstantInt/Float/... > > Feel free to elaborate on your concerns.Have you tested your thesis that no one walks the use-def chains? You could just add an assertion to the compiler (the methods like use_begin() hasOneUse() etc), that aborts on constants, then run the test suite. -Chris