<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>It might be they are not required.<br>
<br>
In example like<br>
<br>
{-# OPTIONS_GHC -ddump-simpl -dsuppress-all #-}<br>
<br>
import System.Environment<br>
import Data.Word<br>
<br>
main :: IO ()<br>
main = do<br>
[x',y'] <- getArgs<br>
let x, y :: Word<br>
x = read x'<br>
y = read y'<br>
<br>
print (not (x == y))<br>
<br>
GHC is smart enough to just swap the branches, relevant optimized
core looks like<br>
<br>
case x_a4Tc of { W# x2_a3Wb -><br>
case x1_X4Ua of { W# y_a3Wf -><br>
case eqWord# x2_a3Wb y_a3Wf of {<br>
__DEFAULT -> $fShowBool2;<br>
1# -> $fShowBool4<br>
}<br>
}<br>
};<br>
<br>
where `$fShowBool*` are (probably, I haven't checked) printing
True or False.<br>
<br>
I.e. expressions which are "case (not x) of True -> ..., False
-> ..." optimize well,<br>
early enough. (IIRC that's the example used for case-of-case
optimization).<br>
<br>
- Oleg<br>
</p>
<div class="moz-cite-prefix">On 20.10.2021 19.55, Sven Panne wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CANBN=ms_TifrSe2Y=+Q011k8Ve2uFxz8v5NC870sNP2OeRc+Wg@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">Am Mi., 20. Okt. 2021 um 18:51 Uhr schrieb Oleg
Grenrus <<a href="mailto:oleg.grenrus@iki.fi"
moz-do-not-send="true">oleg.grenrus@iki.fi</a>>:<br>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">[...] Also, we coudl add
builtin rewrite rules, rewriting not (eqInt8 x y)<br>
to neInt8 x y if some benchmarks show that it would be
beneficial.</blockquote>
<div><br>
</div>
<div>Hopefully such peephole optimizations are done much more
generally further down the compilation pipeline, otherwise
we will have more serious performance problems than the
removal of (/=) from Eq. ;-)</div>
</div>
</div>
</blockquote>
</body>
</html>