]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: ensure that loop condition is detected correctly
authorKeith Randall <khr@google.com>
Mon, 2 Jul 2018 22:21:35 +0000 (15:21 -0700)
committerKeith Randall <khr@golang.org>
Mon, 9 Jul 2018 18:23:39 +0000 (18:23 +0000)
commit58d287e5e863cd8d3c3525e1a04e424e748cf242
treedf0d5ffeab78593f18073b764bccded84e62a9a5
parent9b7a8aaaf3adbc330ef724fb581b3bfa72ab2a49
cmd/compile: ensure that loop condition is detected correctly

We need to make sure that the terminating comparison has the right
sense given the increment direction. If the increment is positive,
the terminating comparsion must be < or <=. If the increment is
negative, the terminating comparison must be > or >=.

Do a few cleanups,  like constant-folding entry==0, adding comments,
removing unused "exported" fields.

Fixes #26116

Change-Id: I14230ee8126054b750e2a1f2b18eb8f09873dbd5
Reviewed-on: https://go-review.googlesource.com/121940
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
src/cmd/compile/internal/ssa/loopbce.go
test/fixedbugs/issue26116.go [new file with mode: 0644]
test/loopbce.go
test/prove.go