[CMake] Don't LTO optimize targets on Darwin, but only if its not ThinLTO
authorAzharuddin Mohammed <azhar@apple.com>
Wed, 21 Jul 2021 22:41:24 +0000 (15:41 -0700)
committerAzharuddin Mohammed <azhar@apple.com>
Sat, 24 Jul 2021 05:38:35 +0000 (22:38 -0700)
commit8da3b7d857298a306973ea8f78c35adb5ba89837
tree462aaed5ee6557885ad7ce94d018843741a3f5f4
parent5ec0f051c8790653cf4e0f59b8a9048c2dca86e8
[CMake] Don't LTO optimize targets on Darwin, but only if its not ThinLTO

This is just a workaround. Pass the `-mllvm,-O0` link flags only if its
not ThinLTO. Doing that with ThinLTO currently results in an error:

```
Remaining virtual register operands
UNREACHABLE executed at .../llvm/lib/CodeGen/MachineRegisterInfo.cpp:209!
```
llvm/cmake/modules/AddLLVM.cmake