thread1

help

Click on a value or block to toggle highlighting of that value/block and its uses. (Values and blocks are highlighted by ID, and IDs of dead items may be reused, so not all highlights necessarily correspond to the clicked item.)

Faded out values and blocks are dead code that has not been eliminated.

Values printed in italics have a dependency cycle.

CFG: Dashed edge is for unlikely branches. Blue color is for backward edges. Edge with a dot means that this edge follows the order in which blocks were laidout.

sources

 
 
12
13
14
15
16
 
/Users/fanlv/Desktop/go_compiler_test/demo.go
func thread1() {
for {
counter++
}
}

AST

buildssa-enter
buildssa-body
. FOR l(13) tc(1)
. . BLOCK l(13)
. FOR-body
. . AS l(14) tc(1) implicit(true) int
. . . NAME-main.counter l(3) x(0) class(PEXTERN) tc(1) assigned used int
. . . ADD l(14) tc(1) int
. . . . NAME-main.counter l(3) x(0) class(PEXTERN) tc(1) assigned used int
. . . . LITERAL-1 l(14) tc(1) int
buildssa-exit
 

start

  • b1:
    • v1 (?) = InitMem <mem>
    • v2 (?) = SP <uintptr>
    • v3 (?) = SB <uintptr>
    • v4 (?) = Addr <*int> {"".counter} v3
    • v7 (?) = Const64 <int> [1]
    • v9 (?) = Addr <*int> {"".counter} v3
  • Plainb2 (13)
  • b2: ← b1 b4
    • v12 (14) = Phi <mem> v1 v10
  • Plainb3 (14)
  • b3: ← b2
    • v5 (14) = Copy <mem> v12
    • v6 (14) = Load <int> v4 v5
    • v8 (14) = Add64 <int> v6 v7
    • v10 (14) = Store <mem> {int} v9 v8 v5
  • Plainb4 (14)
  • b4: ← b3
  • Plainb2 (14)
  • b5:
    • v11 (16) = Unknown <mem>
  • Ret v11

number lines [8785 ns]

decompose user [13588 ns]

opt [1308829 ns]

  • b1:
    • v1 (?) = InitMem <mem>
    • v3 (?) = SB <uintptr>
    • v4 (?) = Addr <*int> {"".counter} v3
    • v7 (?) = Const64 <int> [1]
    • v9 (?) = Addr <*int> {"".counter} v3
  • Plainb2 (+13)
  • b2: ← b1 b4
    • v12 (14) = Phi <mem> v1 v10
  • Plainb3 (+14)
  • b3: ← b2
    • v6 (14) = Load <int> v4 v12
    • v8 (14) = Add64 <int> v6 v7
    • v10 (14) = Store <mem> {int} v9 v8 v12
  • Plainb4 (14)
  • b4: ← b3
  • Plainb2 (14)
  • b5:
    • v11 (16) = Unknown <mem>
  • Ret v11

zero arg cse [2143 ns]

  • b1:
    • v1 (?) = InitMem <mem>
    • v3 (?) = SB <uintptr>
    • v4 (?) = Addr <*int> {"".counter} v3
    • v7 (?) = Const64 <int> [1]
    • v9 (?) = Addr <*int> {"".counter} v3
    • v11 (16) = Unknown <mem>
  • Plainb2 (+13)
  • b2: ← b1 b4
    • v12 (14) = Phi <mem> v1 v10
  • Plainb3 (+14)
  • b3: ← b2
    • v6 (14) = Load <int> v4 v12
    • v8 (14) = Add64 <int> v6 v7
    • v10 (14) = Store <mem> {int} v9 v8 v12
  • Plainb4 (14)
  • b4: ← b3
  • Plainb2 (14)
  • b5:
  • Ret v11

opt deadcode [3167 ns]

  • b1:
  • Plainb2 (+13)
  • b2: ← b1 b4
  • Plainb3 (+14)
  • b3: ← b2
  • Plainb4 (14)
  • b4: ← b3
  • Plainb2 (14)

gcse deadcode [968 ns]

decompose builtin [1404 ns]

expand calls [112493 ns]

  • b1:
    • v10 (13) = SB <uintptr>
    • v8 (13) = SP <uintptr>
  • Plainb2 (+13)
  • b2: ← b1 b4
  • Plainb3 (+14)
  • b3: ← b2
  • Plainb4 (14)
  • b4: ← b3
  • Plainb2 (14)

softfloat [18474 ns]

late opt [1289 ns]

  • b1:
  • Plainb2 (+13)
  • b2: ← b1 b4
  • Plainb3 (+14)
  • b3: ← b2
  • Plainb4 (14)
  • b4: ← b3
  • Plainb2 (14)

generic deadcode [1019 ns]

writebarrier [14088 ns]

lower [406344 ns]

tighten tuple selectors [368 ns]

lowered deadcode [946 ns]

checkLower [13207 ns]

critical [12994 ns]

layout [14810 ns]

schedule [28865 ns]

flagalloc [13418 ns]

regalloc [665687 ns]

stackframe [670 ns]

  • b1:
  • Plainb2 (+13)
  • b2: ← b1 b4
  • Plainb3 (+14)
  • b3: ← b2
  • Plainb4 (14)
  • b4: ← b3
  • Plainb2 (14)

genssa

# /Users/fanlv/Desktop/go_compiler_test/demo.go
00000 (12) TEXT "".thread1(SB), ABIInternal
00001 (12) FUNCDATA $0, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
00002 (12) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
b1
00003 (+13) JMP 4
b2
00004 (+14) JMP 5
b3
00005 (14) JMP 6
b4
00006 (14) JMP 4
00007 (?) END