<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Crash during build when removing instruction sets"
   href="https://bugs.llvm.org/show_bug.cgi?id=43503">43503</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash during build when removing instruction sets
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rene.sugar@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I tried modifying the code generation of the Homebrew LLVM formula to build
without instructions illegal on my computer's CPU.

The version of clang that came with Xcode runs...

clang --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

but, clang build via Homebrew is failing when trying to remove instruction sets
not supported by my computer's CPU.


Steps:

1. brew edit llvm

2. Add CMAKE_CXX_FLAGS to
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/llvm.rb

<a href="https://github.com/Homebrew/homebrew-core/blob/master/Formula/llvm.rb">https://github.com/Homebrew/homebrew-core/blob/master/Formula/llvm.rb</a>

a) fails later

-DCMAKE_CXX_FLAGS:STRING='--target=x86_64-apple-darwin16.6.0\ -mno-sse4a\
-mno-sse4.2\ -mno-avx'

b) fails earlier

-DCMAKE_CXX_FLAGS:STRING='--target=x86_64-apple-darwin16.6.0\ -mno-sse\
-mno-sse2\ -mno-sse3\ -mno-ssse3\ -mno-sse4a\ -mno-sse4.1\ -mno-sse4.2\
-mno-avx'

3. brew install --build-from-source --verbose llvm

4. LLVM build fails in different places depending upon which instruction sets
are turned off.


Older MacBook Pro with the following capabilities:

<a href="https://github.com/Mysticial/FeatureDetector">https://github.com/Mysticial/FeatureDetector</a>

./FeatureDetector_main
CPU Vendor String: GenuineIntel

CPU Vendor:
    AMD         = No
    Intel       = Yes

OS Features:
    OS AVX      = No
    OS AVX512   = No

Hardware Features:
    MMX         = Yes
    x64         = Yes
    ABM         = No
    RDRAND      = No
    BMI1        = No
    BMI2        = No
    ADX         = No
    MPX         = No
    PREFETCHWT1 = No

SIMD: 128-bit
    SSE         = Yes
    SSE2        = Yes
    SSE3        = Yes
    SSSE3       = Yes
    SSE4a       = No
    SSE4.1      = Yes
    SSE4.2      = No
    AES-NI      = No
    SHA         = No

SIMD: 256-bit
    AVX         = No
    XOP         = No
    FMA3        = No
    FMA4        = No
    AVX2        = No

SIMD: 512-bit
    AVX512-F    = No
    AVX512-CD   = No
    AVX512-PF   = No
    AVX512-ER   = No
    AVX512-VL   = No
    AVX512-BW   = No
    AVX512-DQ   = No
    AVX512-IFMA = No
    AVX512-VBMI = No

Summary:
    Safe to use AVX:     No
    Safe to use AVX512:  No


Just setting the following allows Homebrew LLVM to build but instructions
illegal on my computer's CPU are included causing a crash when trying to
compile the regex Python extension:

export MACOSX_DEPLOYMENT_TARGET=10.12
export CFLAGS=--target=x86_64-apple-darwin16.6.0

<a href="https://bitbucket.org/mrabarnett/mrab-regex/">https://bitbucket.org/mrabarnett/mrab-regex/</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>