Skip to content

Commit 214be5b

Browse files
committed
cmd/compile: remove likely bits from generated assembly
We don't need them any more since #15837 was fixed. Fixes #19718 Change-Id: I13e46c62b321b2c9265f44c977b63bfb23163ca2 Reviewed-on: https://go-review.googlesource.com/38664 Run-TryBot: Keith Randall <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-by: Josh Bleecher Snyder <[email protected]>
1 parent 2ebe1bd commit 214be5b

File tree

5 files changed

+7
-70
lines changed

5 files changed

+7
-70
lines changed

src/cmd/compile/internal/amd64/ssa.go

-15
Original file line numberDiff line numberDiff line change
@@ -956,12 +956,10 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
956956
ssa.BlockAMD64ULT, ssa.BlockAMD64UGT,
957957
ssa.BlockAMD64ULE, ssa.BlockAMD64UGE:
958958
jmp := blockJump[b.Kind]
959-
likely := b.Likely
960959
var p *obj.Prog
961960
switch next {
962961
case b.Succs[0].Block():
963962
p = s.Prog(jmp.invasm)
964-
likely *= -1
965963
p.To.Type = obj.TYPE_BRANCH
966964
s.Branches = append(s.Branches, gc.Branch{P: p, B: b.Succs[1].Block()})
967965
case b.Succs[1].Block():
@@ -977,19 +975,6 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
977975
s.Branches = append(s.Branches, gc.Branch{P: q, B: b.Succs[1].Block()})
978976
}
979977

980-
// liblink reorders the instruction stream as it sees fit.
981-
// Pass along what we know so liblink can make use of it.
982-
// TODO: Once we've fully switched to SSA,
983-
// make liblink leave our output alone.
984-
switch likely {
985-
case ssa.BranchUnlikely:
986-
p.From.Type = obj.TYPE_CONST
987-
p.From.Offset = 0
988-
case ssa.BranchLikely:
989-
p.From.Type = obj.TYPE_CONST
990-
p.From.Offset = 1
991-
}
992-
993978
default:
994979
b.Fatalf("branch not implemented: %s. Control: %s", b.LongString(), b.Control.LongString())
995980
}

src/cmd/compile/internal/gc/ssa.go

+7-23
Original file line numberDiff line numberDiff line change
@@ -4419,40 +4419,24 @@ type FloatingEQNEJump struct {
44194419
Index int
44204420
}
44214421

4422-
func (s *SSAGenState) oneFPJump(b *ssa.Block, jumps *FloatingEQNEJump, likely ssa.BranchPrediction) {
4422+
func (s *SSAGenState) oneFPJump(b *ssa.Block, jumps *FloatingEQNEJump) {
44234423
p := s.Prog(jumps.Jump)
44244424
p.To.Type = obj.TYPE_BRANCH
44254425
to := jumps.Index
44264426
s.Branches = append(s.Branches, Branch{p, b.Succs[to].Block()})
4427-
if to == 1 {
4428-
likely = -likely
4429-
}
4430-
// liblink reorders the instruction stream as it sees fit.
4431-
// Pass along what we know so liblink can make use of it.
4432-
// TODO: Once we've fully switched to SSA,
4433-
// make liblink leave our output alone.
4434-
switch likely {
4435-
case ssa.BranchUnlikely:
4436-
p.From.Type = obj.TYPE_CONST
4437-
p.From.Offset = 0
4438-
case ssa.BranchLikely:
4439-
p.From.Type = obj.TYPE_CONST
4440-
p.From.Offset = 1
4441-
}
44424427
}
44434428

44444429
func (s *SSAGenState) FPJump(b, next *ssa.Block, jumps *[2][2]FloatingEQNEJump) {
4445-
likely := b.Likely
44464430
switch next {
44474431
case b.Succs[0].Block():
4448-
s.oneFPJump(b, &jumps[0][0], likely)
4449-
s.oneFPJump(b, &jumps[0][1], likely)
4432+
s.oneFPJump(b, &jumps[0][0])
4433+
s.oneFPJump(b, &jumps[0][1])
44504434
case b.Succs[1].Block():
4451-
s.oneFPJump(b, &jumps[1][0], likely)
4452-
s.oneFPJump(b, &jumps[1][1], likely)
4435+
s.oneFPJump(b, &jumps[1][0])
4436+
s.oneFPJump(b, &jumps[1][1])
44534437
default:
4454-
s.oneFPJump(b, &jumps[1][0], likely)
4455-
s.oneFPJump(b, &jumps[1][1], likely)
4438+
s.oneFPJump(b, &jumps[1][0])
4439+
s.oneFPJump(b, &jumps[1][1])
44564440
q := s.Prog(obj.AJMP)
44574441
q.To.Type = obj.TYPE_BRANCH
44584442
s.Branches = append(s.Branches, Branch{q, b.Succs[1].Block()})

src/cmd/compile/internal/ppc64/ssa.go

-15
Original file line numberDiff line numberDiff line change
@@ -1110,12 +1110,10 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
11101110
ssa.BlockPPC64FLT, ssa.BlockPPC64FGE,
11111111
ssa.BlockPPC64FLE, ssa.BlockPPC64FGT:
11121112
jmp := blockJump[b.Kind]
1113-
likely := b.Likely
11141113
var p *obj.Prog
11151114
switch next {
11161115
case b.Succs[0].Block():
11171116
p = s.Prog(jmp.invasm)
1118-
likely *= -1
11191117
p.To.Type = obj.TYPE_BRANCH
11201118
s.Branches = append(s.Branches, gc.Branch{P: p, B: b.Succs[1].Block()})
11211119
if jmp.invasmun {
@@ -1147,19 +1145,6 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
11471145
s.Branches = append(s.Branches, gc.Branch{P: q, B: b.Succs[1].Block()})
11481146
}
11491147

1150-
// liblink reorders the instruction stream as it sees fit.
1151-
// Pass along what we know so liblink can make use of it.
1152-
// TODO: Once we've fully switched to SSA,
1153-
// make liblink leave our output alone.
1154-
//switch likely {
1155-
//case ssa.BranchUnlikely:
1156-
// p.From.Type = obj.TYPE_CONST
1157-
// p.From.Offset = 0
1158-
//case ssa.BranchLikely:
1159-
// p.From.Type = obj.TYPE_CONST
1160-
// p.From.Offset = 1
1161-
//}
1162-
11631148
default:
11641149
b.Fatalf("branch not implemented: %s. Control: %s", b.LongString(), b.Control.LongString())
11651150
}

src/cmd/compile/internal/s390x/ssa.go

-2
Original file line numberDiff line numberDiff line change
@@ -789,12 +789,10 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
789789
ssa.BlockS390XLE, ssa.BlockS390XGT,
790790
ssa.BlockS390XGEF, ssa.BlockS390XGTF:
791791
jmp := blockJump[b.Kind]
792-
likely := b.Likely
793792
var p *obj.Prog
794793
switch next {
795794
case b.Succs[0].Block():
796795
p = s.Prog(jmp.invasm)
797-
likely *= -1
798796
p.To.Type = obj.TYPE_BRANCH
799797
s.Branches = append(s.Branches, gc.Branch{P: p, B: b.Succs[1].Block()})
800798
case b.Succs[1].Block():

src/cmd/compile/internal/x86/ssa.go

-15
Original file line numberDiff line numberDiff line change
@@ -818,12 +818,10 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
818818
ssa.Block386ULT, ssa.Block386UGT,
819819
ssa.Block386ULE, ssa.Block386UGE:
820820
jmp := blockJump[b.Kind]
821-
likely := b.Likely
822821
var p *obj.Prog
823822
switch next {
824823
case b.Succs[0].Block():
825824
p = s.Prog(jmp.invasm)
826-
likely *= -1
827825
p.To.Type = obj.TYPE_BRANCH
828826
s.Branches = append(s.Branches, gc.Branch{P: p, B: b.Succs[1].Block()})
829827
case b.Succs[1].Block():
@@ -839,19 +837,6 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
839837
s.Branches = append(s.Branches, gc.Branch{P: q, B: b.Succs[1].Block()})
840838
}
841839

842-
// liblink reorders the instruction stream as it sees fit.
843-
// Pass along what we know so liblink can make use of it.
844-
// TODO: Once we've fully switched to SSA,
845-
// make liblink leave our output alone.
846-
switch likely {
847-
case ssa.BranchUnlikely:
848-
p.From.Type = obj.TYPE_CONST
849-
p.From.Offset = 0
850-
case ssa.BranchLikely:
851-
p.From.Type = obj.TYPE_CONST
852-
p.From.Offset = 1
853-
}
854-
855840
default:
856841
b.Fatalf("branch not implemented: %s. Control: %s", b.LongString(), b.Control.LongString())
857842
}

0 commit comments

Comments
 (0)