Skip to content

Commit 70e82e0

Browse files
committed
go/analysis/passes/asmdecl: Correct identify writeResult instructions
This CL ensure all occurrences of writeResult instructions are identified, not just those at the beginning of the line without indentation. This CL also fixes this and changed testcases to match other ABIInternal test. Change-Id: I1ce6ea22a227902819dc4e0caafa4bace79c15fe Reviewed-on: https://go-review.googlesource.com/c/tools/+/620056 Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Carlos Amedee <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent cbd92b1 commit 70e82e0

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

go/analysis/passes/asmdecl/asmdecl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ Files:
354354

355355
if abi == "ABIInternal" && !haveRetArg {
356356
for _, ins := range archDef.writeResult {
357-
if strings.HasPrefix(line, ins) {
357+
if strings.Contains(line, ins) {
358358
haveRetArg = true
359359
break
360360
}

go/analysis/passes/asmdecl/testdata/src/a/asm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ func returnint() int
3030
func returnbyte(x int) byte
3131
func returnnamed(x byte) (r1 int, r2 int16, r3 string, r4 byte)
3232
func returnintmissing() int
33-
func returnsyscall()
3433
func leaf(x, y int) int
3534

3635
func noprof(x int)
@@ -55,5 +54,6 @@ func pickFutureABI(x int)
5554

5655
func returnABIInternal() int
5756
func returnmissingABIInternal() int
57+
func returnsyscallABIInternal() int
5858

5959
func retjmp() int

go/analysis/passes/asmdecl/testdata/src/a/asm1.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ TEXT ·returnmissingABIInternal<ABIInternal>(SB), NOSPLIT, $32
354354
RET // want `RET without writing to result register`
355355

356356
// issue 69352
357-
TEXT ·returnsyscall<ABIInternal>(SB),0,$0-0
357+
TEXT ·returnsyscallABIInternal<ABIInternal>(SB), NOSPLIT, $0
358358
MOVQ $123, CX
359359
SYSCALL
360360
RET

go/analysis/passes/asmdecl/testdata/src/a/asm11.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ TEXT ·returnmissingABIInternal<ABIInternal>(SB), NOSPLIT, $8
1313
RET // want `RET without writing to result register`
1414

1515
// issue 69352
16-
TEXT ·returnsyscall<ABIInternal>(SB),0,$0-0
16+
TEXT ·returnsyscallABIInternal<ABIInternal>(SB), NOSPLIT, $0
1717
MOV $123, X20
1818
ECALL
1919
RET

go/analysis/passes/asmdecl/testdata/src/a/asm7.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ TEXT ·returnmissingABIInternal<ABIInternal>(SB), NOSPLIT, $8
200200
RET // want `RET without writing to result register`
201201

202202
// issue 69352
203-
TEXT ·returnsyscall<ABIInternal>(SB),0,$0-0
203+
TEXT ·returnsyscallABIInternal<ABIInternal>(SB), NOSPLIT, $0
204204
MOVD $123, R10
205205
SYSCALL
206206
RET

0 commit comments

Comments
 (0)