aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/_gen/generic.rules
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/ssa/_gen/generic.rules')
-rw-r--r--src/cmd/compile/internal/ssa/_gen/generic.rules8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/ssa/_gen/generic.rules b/src/cmd/compile/internal/ssa/_gen/generic.rules
index 398601e81b..70bac217fa 100644
--- a/src/cmd/compile/internal/ssa/_gen/generic.rules
+++ b/src/cmd/compile/internal/ssa/_gen/generic.rules
@@ -2799,7 +2799,11 @@
// 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)))
+(SelectN [0] (StaticLECall {f} x y (SelectN [1] c:(StaticLECall {g} x y mem))))
&& isSameCall(f, "runtime.cmpstring")
&& isSameCall(g, "runtime.cmpstring")
-=> (MakeResult (SelectN [0] <typ.Int> c) m)
+=> @c.Block (SelectN [0] <typ.Int> c)
+
+// If we don't use the result of cmpstring, might as well not call it.
+// Note that this could pretty easily generalize to any pure function.
+(SelectN [1] c:(StaticLECall {f} _ _ mem)) && c.Uses == 1 && isSameCall(f, "runtime.cmpstring") && clobber(c) => mem