• Giovanni Bajo's avatar
    cmd/compile: in poset, implement path collapsing · c70e5475
    Giovanni Bajo authored
    Sometimes, poset needs to collapse a path making all nodes in
    the path aliases. For instance, we know that A<=N1<=B and we
    learn that B<=A, we can deduce A==N1==B, and thus we can
    collapse all paths from A to B into a single aliased node.
    
    Currently, this is a TODO. This CL implements the path-collapsing
    primitive by doing a DFS walk to build a bitset of all nodes
    across all paths, and then calling the new aliasnodes that allow
    to mark multiple nodes as aliases of a single master node.
    
    This helps only 4 times in std+cmd, but it will be fundamental
    when we will rely on poset to calculate numerical limits, to
    calculate the correct values.
    
    This also fixes #35157, a bug uncovered by a previous CL in this
    serie. A testcase will be added soon.
    
    Change-Id: I5fc54259711769d7bd7c2d166a5abc1cddc26350
    Reviewed-on: https://go-review.googlesource.com/c/go/+/200861
    Run-TryBot: Giovanni Bajo <rasky@develer.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarKeith Randall <khr@golang.org>
    c70e5475
poset_test.go 18.1 KB