GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:14:48Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/14982LLVM default -mcpu setting inhibits customization2019-07-07T18:14:48ZThomas Main DuBuissonLLVM default -mcpu setting inhibits customizationWith GHC 8.4.1 we are now passing a default `-mcpu` selection to llvm. This default is passed regardless of any explicit command line option such as `-optlc=-mcpu=native`. If/when the user explicitly specifies the architecture we now get...With GHC 8.4.1 we are now passing a default `-mcpu` selection to llvm. This default is passed regardless of any explicit command line option such as `-optlc=-mcpu=native`. If/when the user explicitly specifies the architecture we now get a failed build. The error message from LLVM is:
```
llc: for the -mcpu option: may only occur zero or one times!
`llc' failed in phase `LLVM Compiler'. (Exit code: 1)
```
This is when compiling with GHC 8.4.1 as such:
{{{
ghc-8.4.1 -fforce-recomp -fllvm -optlc=-mcpu=native -O2 tt.hs
}}
I suggest we either check for a user option of `mcpu` before adding the default or revert this behavior and allow llvm to take it's (optimistic and less portable) default.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | --------------- |
| Version | 8.4.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (LLVM) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"LLVM default -mcpu setting inhibits customization","status":"New","operating_system":"","component":"Compiler (LLVM)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"With GHC 8.4.1 we are now passing a default `-mcpu` selection to llvm. This default is passed regardless of any explicit command line option such as `-optlc=-mcpu=native`. If/when the user explicitly specifies the architecture we now get a failed build. The error message from LLVM is:\r\n\r\n{{{\r\nllc: for the -mcpu option: may only occur zero or one times!\r\n`llc' failed in phase `LLVM Compiler'. (Exit code: 1)\r\n}}}\r\n\r\nThis is when compiling with GHC 8.4.1 as such:\r\n\r\n{{{\r\nghc-8.4.1 -fforce-recomp -fllvm -optlc=-mcpu=native -O2 tt.hs\r\n}}\r\n\r\nI suggest we either check for a user option of `mcpu` before adding the default or revert this behavior and allow llvm to take it's (optimistic and less portable) default.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.4.2