Source file test/mem2regsimd.go
1 // errorcheck -0 -d=ssa/mem2reg/debug=4 2 3 //go:build goexperiment.simd 4 5 // Copyright 2026 The Go Authors. All rights reserved. 6 // Use of this source code is governed by a BSD-style 7 // license that can be found in the LICENSE file. 8 9 // Test for variables accessed through pointers that can 10 // be promoted to register by the mem2reg pass. 11 12 package main 13 14 import "simd/archsimd" 15 16 // Control flow: if/else 17 // 18 //go:noinline 19 func ifElseAddrSIMD(c bool) archsimd.Int8x16 { 20 x := archsimd.Int8x16{} // ERROR "promoted x in cross block case" 21 p := &x 22 if c { 23 *p = (*p).Add(*p) 24 } else { 25 *p = archsimd.LoadInt8x16Array(&[16]int8{1}) 26 } 27 return *p 28 } 29