<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/76376>76376</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            "[CostModel][X86] Add CostKinds handling for fdiv ops" breaks building asymptote
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            RKSimon
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          brad0
      </td>
    </tr>
</table>

<pre>
    After doing a git bisect to find out why building asymptote broke somewhere in between Clang 15 and 16 I
came to the commit 5aee2726d8a6cb1698b11574ebb0e0499369a3d2

```
PATCH] [CostModel][X86] Add CostKinds handling for fdiv ops

This was achieved with an updated version of the 'cost-tables vs llvm-mca' script D103695

As we're using 'typical' worst case values, not all cost entries come from a single CPU - e.g. the latency/throughput from haswell but the size-latency(uops) from zen1/alderlake-e due to 'double pumping'

As the uop count (used for TCK_SizeAndLatency) for divss/divps is typically so low, we need to override isExpensiveToSpeculativelyExecute to ensure we keep fdiv calls behind branches - although for some very recent cpu targets it might not be necessary any more and could be relaxed.
```

If I roll back to the commit just before that, 22e1f66f26b867ec2bb53c8d9ace489e0a54b1a0, it builds fine.

We noticed this on OpenBSD when updating from Clang 13 to 16. Looking at the FreeBSD port they also saw
this when updating from 15 to 16. Builds fine with Clang 13, 14 and 15. 16, 17, and ToT broken.

```
../asy -dir ../base -config "" -render=0 -f pdf -noprc westnile.asy
  real b=arctime(g,arclength(g)-end);
 ^
../base/plain_margins.asy: 10.3: runtime: gmake[3]: *** [Makefile:42: westnile.pdf] Floating point exception (core dumped)
```

For OpenBSD we introduced some workarounds to disable optimization just to be able to build with base 16.

https://raw.githubusercontent.com/openbsd/ports/master/graphics/asymptote/patches/patch-path_cc
https://raw.githubusercontent.com/openbsd/ports/master/graphics/asymptote/patches/patch-triple_h
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJ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