diff options
Diffstat (limited to 'src/cmd/compile/internal/ssa/_gen/generic.rules')
-rw-r--r-- | src/cmd/compile/internal/ssa/_gen/generic.rules | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/_gen/generic.rules b/src/cmd/compile/internal/ssa/_gen/generic.rules index 4c475d31e00..398601e81b4 100644 --- a/src/cmd/compile/internal/ssa/_gen/generic.rules +++ b/src/cmd/compile/internal/ssa/_gen/generic.rules @@ -2794,3 +2794,12 @@ (Load <t> (OffPtr [off] (Convert (Addr {sym} _) _) ) _) && t.IsInteger() && t.Size() == 4 && isFixed32(config, sym, off) => (Const32 [fixed32(config, sym, off)]) (Load <t> (OffPtr [off] (ITab (IMake (Addr {sym} _) _))) _) && t.IsInteger() && t.Size() == 4 && isFixed32(config, sym, off) => (Const32 [fixed32(config, sym, off)]) (Load <t> (OffPtr [off] (ITab (IMake (Convert (Addr {sym} _) _) _))) _) && t.IsInteger() && t.Size() == 4 && isFixed32(config, sym, off) => (Const32 [fixed32(config, sym, off)]) + +// Calling cmpstring a second time with the same arguments in the +// same memory state can reuse the results of the first call. +// See issue 61725. +// Note that this could pretty easily generalize to any pure function. +(StaticLECall {f} x y m:(SelectN [1] c:(StaticLECall {g} x y mem))) + && isSameCall(f, "runtime.cmpstring") + && isSameCall(g, "runtime.cmpstring") +=> (MakeResult (SelectN [0] <typ.Int> c) m) |