aboutsummaryrefslogtreecommitdiff
path: root/test/checkbce.go
diff options
context:
space:
mode:
authorYi Yang <qingfeng.yy@alibaba-inc.com>2023-08-31 02:48:34 +0000
committerKeith Randall <khr@golang.org>2023-09-12 21:01:50 +0000
commit4ee1d542eda8d8aab7ca2024a4a0a9068d3cad70 (patch)
tree4c8d6efa3ca9b5d88d7d8c0f1f7f7c3f49fdd6a9 /test/checkbce.go
parenta843991fdd079c931d4e98c0a17c9ac6dc254fe8 (diff)
downloadgo-4ee1d542eda8d8aab7ca2024a4a0a9068d3cad70.tar.gz
go-4ee1d542eda8d8aab7ca2024a4a0a9068d3cad70.zip
cmd/compile: sparse conditional constant propagation
sparse conditional constant propagation can discover optimization opportunities that cannot be found by just combining constant folding and constant propagation and dead code elimination separately. This is a re-submit of PR#59575, which fix a broken dominance relationship caught by ssacheck Updates https://github.com/golang/go/issues/59399 Change-Id: I57482dee38f8e80a610aed4f64295e60c38b7a47 GitHub-Last-Rev: 830016f24e3a5320c6c127a48ab7c84e2fc672eb GitHub-Pull-Request: golang/go#60469 Reviewed-on: https://go-review.googlesource.com/c/go/+/498795 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'test/checkbce.go')
-rw-r--r--test/checkbce.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/checkbce.go b/test/checkbce.go
index 6a126099bc..ab31d95283 100644
--- a/test/checkbce.go
+++ b/test/checkbce.go
@@ -137,6 +137,10 @@ func g4(a [100]int) {
useInt(a[i+50])
// The following are out of bounds.
+ if a[0] == 0xdeadbeef {
+ // This is a trick to prohibit sccp to optimize out the following out of bound check
+ continue
+ }
useInt(a[i-11]) // ERROR "Found IsInBounds$"
useInt(a[i+51]) // ERROR "Found IsInBounds$"
}