<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<title>GitLab</title>
<style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
h2
        {mso-style-priority:9;
        mso-style-link:"Heading 2 Char";
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:18.0pt;
        font-family:"Calibri",sans-serif;
        font-weight:bold;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
p.details, li.details, div.details
        {mso-style-name:details;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.Heading2Char
        {mso-style-name:"Heading 2 Char";
        mso-style-priority:9;
        mso-style-link:"Heading 2";
        font-family:"Calibri Light",sans-serif;
        color:#2F5496;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.line
        {mso-style-name:line;}
span.kr
        {mso-style-name:kr;}
span.nn
        {mso-style-name:nn;}
span.kt
        {mso-style-name:kt;}
span.o
        {mso-style-name:o;}
span.p
        {mso-style-name:p;}
span.n
        {mso-style-name:n;}
span.nf
        {mso-style-name:nf;}
span.cp
        {mso-style-name:cp;}
span.mi
        {mso-style-name:mi;}
span.nb
        {mso-style-name:nb;}
span.EmailStyle36
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1238202050;
        mso-list-template-ids:-1518066410;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:36.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Symbol;}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:72.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:"Courier New";
        mso-bidi-font-family:"Times New Roman";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:108.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:144.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:180.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:216.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:252.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:288.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:324.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1
        {mso-list-id:1738547956;
        mso-list-template-ids:663676778;}
@list l1:level1
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:36.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Symbol;}
@list l1:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:72.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:"Courier New";
        mso-bidi-font-family:"Times New Roman";}
@list l1:level3
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:108.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level4
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:144.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level5
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:180.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level6
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:216.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level7
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:252.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level8
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:288.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level9
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:324.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">I get a 404 for <a href="https://gitlab.haskell.org/ghc/ghc/-/issues/18372">
https://gitlab.haskell.org/ghc/ghc/-/issues/18372</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">You may need to re-submit this…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">s<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Andrzej Rybczak <gitlab@gitlab.haskell.org>
<br>
<b>Sent:</b> 21 June 2020 15:44<br>
<b>To:</b> Simon Peyton Jones <simonpj@microsoft.com><br>
<b>Subject:</b> GHC/ | GHC doesn't inline small type class method marked as INLINE with profiling enabled (#18372)<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="details"><i><span lang="EN" style="color:#777777"><a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.haskell.org%2Farybczak&data=02%7C01%7Csimonpj%40microsoft.com%7C69826edc95e94f123d4208d815f18406%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637283474331207255&sdata=oSLeWvPZsSFhqr07wt3RveuWf9F%2Bs052fjkuTKEVzqE%3D&reserved=0">Andrzej
 Rybczak</a> created an issue: <o:p></o:p></span></i></p>
<h2><span lang="EN">Summary<o:p></o:p></span></h2>
<p><span lang="EN">When profiling is enabled, GHC doesn't inline small type class methods which prevents further optimizations and specialization from happening.<o:p></o:p></span></p>
<h2><span lang="EN">Steps to reproduce<o:p></o:p></span></h2>
<p><span lang="EN">When the following module:<o:p></o:p></span></p>
<pre><span class="kr"><span lang="EN">module</span></span><span class="line"><span lang="EN"> </span></span><span class="nn"><span lang="EN">Main</span></span><span class="line"><span lang="EN"> </span></span><span class="kr"><span lang="EN">where</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><code><span lang="EN"><o:p> </o:p></span></code></pre>
<pre><span class="kr"><span lang="EN">import</span></span><span class="line"><span lang="EN"> </span></span><span class="nn"><span lang="EN">Optics.Core</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><code><span lang="EN"><o:p> </o:p></span></code></pre>
<pre><span class="kr"><span lang="EN">data</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">T</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">=</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">T</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">{</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">_t1</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">::</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">Int</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">           </span></span><span class="p"><span lang="EN">,</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">_t2</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">::</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">Int</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">           </span></span><span class="p"><span lang="EN">}</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><code><span lang="EN"><o:p> </o:p></span></code></pre>
<pre><span class="n"><span lang="EN">t1</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">::</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">Lens'</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">T</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">Int</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="n"><span lang="EN">t1</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">=</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">lensVL</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">$</span></span><span class="line"><span lang="EN"> </span></span><span class="nf"><span lang="EN">\</span></span><span class="n"><span lang="EN">f</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">s</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">-></span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">(</span></span><span class="nf"><span lang="EN">\</span></span><span class="n"><span lang="EN">n</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">-></span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">s</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">{</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">_t1</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">=</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">n</span></span><span class="p"><span lang="EN">})</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN"><$></span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">f</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">(</span></span><span class="n"><span lang="EN">_t1</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">s</span></span><span class="p"><span lang="EN">)</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="cp"><span lang="EN">{-# INLINE t1 #-}</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><code><span lang="EN"><o:p> </o:p></span></code></pre>
<pre><span class="n"><span lang="EN">t2</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">::</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">Lens'</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">T</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">Int</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="n"><span lang="EN">t2</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">=</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">lensVL</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">$</span></span><span class="line"><span lang="EN"> </span></span><span class="nf"><span lang="EN">\</span></span><span class="n"><span lang="EN">f</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">s</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">-></span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">(</span></span><span class="nf"><span lang="EN">\</span></span><span class="n"><span lang="EN">n</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">-></span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">s</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">{</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">_t2</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">=</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">n</span></span><span class="p"><span lang="EN">})</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN"><$></span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">f</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">(</span></span><span class="n"><span lang="EN">_t2</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">s</span></span><span class="p"><span lang="EN">)</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="cp"><span lang="EN">{-# INLINE t2 #-}</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><code><span lang="EN"><o:p> </o:p></span></code></pre>
<pre><span class="n"><span lang="EN">t_val</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">::</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">T</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="n"><span lang="EN">t_val</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">=</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">T</span></span><span class="line"><span lang="EN"> </span></span><span class="mi"><span lang="EN">1</span></span><span class="line"><span lang="EN"> </span></span><span class="mi"><span lang="EN">2</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="cp"><span lang="EN">{-# NOINLINE t_val #-}</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><code><span lang="EN"><o:p> </o:p></span></code></pre>
<pre><span class="n"><span lang="EN">main</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">::</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">IO</span></span><span class="line"><span lang="EN"> </span></span><span class="nb"><span lang="EN">()</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="n"><span lang="EN">main</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">=</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">putStrLn</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">.</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">show</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">$</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">view</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">t1</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">t_val</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">+</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">view</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">t2</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">t_val</span></span><span lang="EN"><o:p></o:p></span></pre>
<p><span lang="EN">is compiled with profiling enabled, here's how core of </span>
<code><span lang="EN" style="font-size:10.0pt">main</span></code><span lang="EN"> looks:<o:p></o:p></span></p>
<pre><span class="n"><span lang="EN">main1</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">  </span></span><span class="o"><span lang="EN">=</span></span><span class="line"><span lang="EN"> </span></span><span class="kr"><span lang="EN">case</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">(((</span></span><span class="o"><span lang="EN">$</span></span><span class="n"><span lang="EN">fStrongForget_</span></span><span class="o"><span lang="EN">$</span></span><span class="n"><span lang="EN">clinear</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">main_l1</span></span><span class="p"><span lang="EN">)</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">(</span></span><span class="n"><span lang="EN">id</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">`</span></span><span class="n"><span lang="EN">cast</span></span><span class="p"><span lang="EN">`</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN"><</span></span><span class="kt"><span lang="EN">Co</span></span><span class="o"><span lang="EN">:</span></span><span class="mi"><span lang="EN">41</span></span><span class="o"><span lang="EN">></span></span><span class="p"><span lang="EN">))</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">          </span></span><span class="p"><span lang="EN">`</span></span><span class="n"><span lang="EN">cast</span></span><span class="p"><span lang="EN">`</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN"><</span></span><span class="kt"><span lang="EN">Co</span></span><span class="o"><span lang="EN">:</span></span><span class="mi"><span lang="EN">42</span></span><span class="o"><span lang="EN">></span></span><span class="p"><span lang="EN">)</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">           </span></span><span class="n"><span lang="EN">t_val</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="kr"><span lang="EN">of</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="p"><span lang="EN">{</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">I</span></span><span class="o"><span lang="EN">#</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">x_a2c8</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">-></span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="kr"><span lang="EN">case</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">(((</span></span><span class="o"><span lang="EN">$</span></span><span class="n"><span lang="EN">fStrongForget_</span></span><span class="o"><span lang="EN">$</span></span><span class="n"><span lang="EN">clinear</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">main_l2</span></span><span class="p"><span lang="EN">)</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">(</span></span><span class="n"><span lang="EN">id</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">`</span></span><span class="n"><span lang="EN">cast</span></span><span class="p"><span lang="EN">`</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN"><</span></span><span class="kt"><span lang="EN">Co</span></span><span class="o"><span lang="EN">:</span></span><span class="mi"><span lang="EN">41</span></span><span class="o"><span lang="EN">></span></span><span class="p"><span lang="EN">))</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">          </span></span><span class="p"><span lang="EN">`</span></span><span class="n"><span lang="EN">cast</span></span><span class="p"><span lang="EN">`</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN"><</span></span><span class="kt"><span lang="EN">Co</span></span><span class="o"><span lang="EN">:</span></span><span class="mi"><span lang="EN">42</span></span><span class="o"><span lang="EN">></span></span><span class="p"><span lang="EN">)</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">           </span></span><span class="n"><span lang="EN">t_val</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="kr"><span lang="EN">of</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="p"><span lang="EN">{</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">I</span></span><span class="o"><span lang="EN">#</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">y_a2cb</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">-></span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="kr"><span lang="EN">case</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">$</span></span><span class="n"><span lang="EN">wshowSignedInt</span></span><span class="line"><span lang="EN"> </span></span><span class="mi"><span lang="EN">0</span></span><span class="o"><span lang="EN">#</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">(</span></span><span class="o"><span lang="EN">+#</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">x_a2c8</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">y_a2cb</span></span><span class="p"><span lang="EN">)</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">[]</span></span><span class="line"><span lang="EN"> </span></span><span class="kr"><span lang="EN">of</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="p"><span lang="EN">{</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">(</span></span><span class="o"><span lang="EN">#</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">ww5_a277</span></span><span class="p"><span lang="EN">,</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">ww6_a278</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">#</span></span><span class="p"><span lang="EN">)</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">-></span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="o"><span lang="EN">:</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">ww5_a277</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">ww6_a278</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="p"><span lang="EN">}</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="p"><span lang="EN">}</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="p"><span lang="EN">}</span></span><span lang="EN"><o:p></o:p></span></pre>
<p><span lang="EN">So </span><code><span lang="EN" style="font-size:10.0pt">linear</span></code><span lang="EN"> doesn't get inlined even though it's a small function that is even
<a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fwell-typed%2Foptics%2Fblob%2F5758cd6a18162cd0a69f4a044026d1bd878cfaf9%2Findexed-profunctors%2Fsrc%2FData%2FProfunctor%2FIndexed.hs%23L355&data=02%7C01%7Csimonpj%40microsoft.com%7C69826edc95e94f123d4208d815f18406%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637283474331207255&sdata=v6agV%2FTB5%2BpzLDcmEdTI8NNf281F39KhfLinCEi7vI0%3D&reserved=0" target="_blank">
explicitly marked INLINE</a>.<o:p></o:p></span></p>
<p><span lang="EN">This prevents further optimizations from happening and leaves optics-related code in semi-optimized state, making looking at cost centers unreliable (see
<a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fwell-typed%2Foptics%2Fissues%2F324&data=02%7C01%7Csimonpj%40microsoft.com%7C69826edc95e94f123d4208d815f18406%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637283474331217249&sdata=ThSQiMn4GzrEWaEg9uFycOCkka32wf9wjXAhznlZ%2Bjo%3D&reserved=0" target="_blank">
well-typed/optics#324</a>).<o:p></o:p></span></p>
<p><span lang="EN">When profiling is disabled, everything inlines and optimizes away as expected:<o:p></o:p></span></p>
<pre><span class="n"><span lang="EN">main1</span></span><span class="line"><span lang="EN"> </span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">  </span></span><span class="o"><span lang="EN">=</span></span><span class="line"><span lang="EN"> </span></span><span class="kr"><span lang="EN">case</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">t_val</span></span><span class="line"><span lang="EN"> </span></span><span class="kr"><span lang="EN">of</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">{</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">T</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">ds_d25F</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">ds1_d25G</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">-></span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="kr"><span lang="EN">case</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">ds_d25F</span></span><span class="line"><span lang="EN"> </span></span><span class="kr"><span lang="EN">of</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">{</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">I</span></span><span class="o"><span lang="EN">#</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">x_a2c7</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">-></span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="kr"><span lang="EN">case</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">ds1_d25G</span></span><span class="line"><span lang="EN"> </span></span><span class="kr"><span lang="EN">of</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">{</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">I</span></span><span class="o"><span lang="EN">#</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">y_a2ca</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">-></span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="kr"><span lang="EN">case</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">$</span></span><span class="n"><span lang="EN">wshowSignedInt</span></span><span class="line"><span lang="EN"> </span></span><span class="mi"><span lang="EN">0</span></span><span class="o"><span lang="EN">#</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">(</span></span><span class="o"><span lang="EN">+#</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">x_a2c7</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">y_a2ca</span></span><span class="p"><span lang="EN">)</span></span><span class="line"><span lang="EN"> </span></span><span class="kt"><span lang="EN">[]</span></span><span class="line"><span lang="EN"> </span></span><span class="kr"><span lang="EN">of</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="p"><span lang="EN">{</span></span><span class="line"><span lang="EN"> </span></span><span class="p"><span lang="EN">(</span></span><span class="o"><span lang="EN">#</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">ww5_a276</span></span><span class="p"><span lang="EN">,</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">ww6_a277</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">#</span></span><span class="p"><span lang="EN">)</span></span><span class="line"><span lang="EN"> </span></span><span class="o"><span lang="EN">-></span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="o"><span lang="EN">:</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">ww5_a276</span></span><span class="line"><span lang="EN"> </span></span><span class="n"><span lang="EN">ww6_a277</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="p"><span lang="EN">}</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="p"><span lang="EN">}</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="p"><span lang="EN">}</span></span><code><span lang="EN"><o:p></o:p></span></code></pre>
<pre><span class="line"><span lang="EN">    </span></span><span class="p"><span lang="EN">}</span></span><span lang="EN"><o:p></o:p></span></pre>
<p><span lang="EN">I'm attaching archive with cabal project that contains above module for easy reproduction:
<a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.haskell.org%2Fghc%2Fghc%2Fuploads%2Fd3c051396724bcac1eeeb17ccb4bc779%2Fprof_test.tar.gz&data=02%7C01%7Csimonpj%40microsoft.com%7C69826edc95e94f123d4208d815f18406%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637283474331217249&sdata=2kBWLGNzNNoLhiU3GF4QsLoL%2BnWEzmLVxmtPoaQ9UfI%3D&reserved=0">
prof_test.tar.gz</a><o:p></o:p></span></p>
<p><span lang="EN">Profiling build was tested with </span><code><span lang="EN" style="font-size:10.0pt">profiling: True</span></code><span lang="EN"> in
</span><code><span lang="EN" style="font-size:10.0pt">cabal.project.local</span></code><span lang="EN">.<o:p></o:p></span></p>
<h2><span lang="EN">Expected behavior<o:p></o:p></span></h2>
<p><span lang="EN">GHC should inline class methods marked as INLINE when profiling is enabled.<o:p></o:p></span></p>
<h2><span lang="EN">Environment<o:p></o:p></span></h2>
<ul type="disc">
<li class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l1 level1 lfo1">
<span lang="EN">GHC version used: 8.10.1<o:p></o:p></span></li></ul>
<p><span lang="EN">Optional:<o:p></o:p></span></p>
<ul type="disc">
<li class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 level1 lfo2">
<span lang="EN">Operating System: Arch Linux<o:p></o:p></span></li><li class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 level1 lfo2">
<span lang="EN">System Architecture: x86_64<o:p></o:p></span></li></ul>
</div>
<div style="margin-top:7.5pt">
<p><span lang="EN" style="font-size:12.0pt;color:#777777">— <br>
Reply to this email directly or <a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.haskell.org%2Fghc%2Fghc%2Fissues%2F18372&data=02%7C01%7Csimonpj%40microsoft.com%7C69826edc95e94f123d4208d815f18406%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637283474331227245&sdata=wlaM1SQDfNLA%2BwRNes4mO6iCnUMDpaAIsGIvzzxuZCI%3D&reserved=0">
view it on GitLab</a>. <br>
You're receiving this email because of your account on gitlab.haskell.org. If you'd like to receive fewer emails, you can
<a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.haskell.org%2Fsent_notifications%2Ffcc5f69e58bc6dfc3bf5cd41bcba0129%2Funsubscribe&data=02%7C01%7Csimonpj%40microsoft.com%7C69826edc95e94f123d4208d815f18406%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637283474331227245&sdata=loI7zT2j7mgb2c2ku3gRt76DkRXQ0nSFebOuetCKqcQ%3D&reserved=0">
unsubscribe</a> from this thread or adjust your notification settings. <o:p></o:p></span></p>
</div>
</div>
</div>
</body>
</html>