@@ -534,10 +534,6 @@ func (b *batch) rewriteWithLiterals(n ir.Node, fn *ir.Func) {
534
534
if n .Op () != ir .OMAKESLICE && n .Op () != ir .OCONVIFACE {
535
535
return
536
536
}
537
- if base .Flag .Cfg .CoverageInfo != nil {
538
- // Avoid altering coverage results.
539
- return
540
- }
541
537
542
538
// Look up a cached ReassignOracle for the function, lazily computing one if needed.
543
539
ro := b .reassignOracle (fn )
@@ -571,6 +567,10 @@ func (b *batch) rewriteWithLiterals(n ir.Node, fn *ir.Func) {
571
567
base .Fatalf ("unexpected BasicLit Kind" )
572
568
}
573
569
if constant .Compare (lit .Val (), token .GEQ , constant .MakeInt64 (0 )) {
570
+ if ! base .LiteralAllocHash .MatchPos (n .Pos (), nil ) {
571
+ // De-selected by literal alloc optimizations debug hash.
572
+ return
573
+ }
574
574
// Preserve any side effects of the original expression, then replace it.
575
575
assignTemp (* r , n .PtrInit ())
576
576
* r = lit
@@ -584,6 +584,10 @@ func (b *batch) rewriteWithLiterals(n ir.Node, fn *ir.Func) {
584
584
if conv .X .Op () != ir .OLITERAL && ! conv .X .Type ().IsInterface () {
585
585
v := ro .StaticValue (conv .X )
586
586
if v != nil && v .Op () == ir .OLITERAL && ir .ValidTypeForConst (conv .X .Type (), v .Val ()) {
587
+ if ! base .LiteralAllocHash .MatchPos (n .Pos (), nil ) {
588
+ // De-selected by literal alloc optimizations debug hash.
589
+ return
590
+ }
587
591
if base .Debug .EscapeDebug >= 3 {
588
592
base .WarnfAt (n .Pos (), "rewriting OCONVIFACE value from %v (%v) to %v (%v)" , conv .X , conv .X .Type (), v , v .Type ())
589
593
}
0 commit comments