cmd/compile: "add some generic composite type optimizations" improperly discards writes to non-autos #26153
Labels
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
release-blocker
Milestone
CL 106495 (commit f31a18d) adds a pass, "dead auto elim", that eliminates local variables that are only written, not read. Under certain circumstances, it can discard writes to non-autos. In this example:
The write on the last line to *ps will be discarded. I think the problem is that
elimDeadAutosGeneric
totally ignores non-autos, even when their existence is important. The phi op that unifiesps
after the if takes two values, essentially&s
andps
. Because the function doesn't care about non-autos, it ignoresps
, and considers the phi to be dead ifs
is dead, which of course it is. Really the whole thing should be kept alive by the (potential) write throughps
.cc @randall77, @TocarIP, @mundaym
The text was updated successfully, but these errors were encountered: