Commit f421735b authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

[dev.ssa] cmd/compile: handle OpCopy loops in rewrite

Change-Id: Icbaad6e5cbfc5430a651538fe90c0a9ee664faf4
Reviewed-on: https://go-review.googlesource.com/12360Reviewed-by: 's avatarKeith Randall <khr@golang.org>
parent c1593da8
......@@ -42,7 +42,10 @@ func applyRewrite(f *Func, rb func(*Block) bool, rv func(*Value, *Config) bool)
if a.Op != OpCopy {
continue
}
for a.Op == OpCopy {
// Rewriting can generate OpCopy loops.
// They are harmless (see removePredecessor),
// but take care not to loop forever.
for a.Op == OpCopy && a != a.Args[0] {
a = a.Args[0]
}
v.Args[i] = a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment