<div dir="ltr">I managed to reproduce the problem locally, and I am still debugging it, but it appears that linking certain binaries (llvm-c-test at least) causes us to create different objects with the same key in some cases.<div><br></div><div>My suspicion is that we are failing to include prevailing symbol information in the hash.</div><div><br></div><div>If I use a separate cache directory for each binary and I diff the symbol tables of the differing objects in the cache directories for llvm-c-test and llvm-dwp they all look like this:</div><div><br></div><div><div><div><font face="monospace, monospace">@@ -16,7 +16,7 @@</font></div><div><font face="monospace, monospace">                  U __PRETTY_FUNCTION__._ZN4llvm18PointerIntPairInfoIPvLj1ENS_22PointerUnionUIntTraitsIPKNS_5ValueEPKNS_17PseudoSourceValueEEEE13updatePointerElS1_.llvm.B5105C7D</font></div><div><font face="monospace, monospace">                  U __PRETTY_FUNCTION__._ZN4llvm18TargetRegisterInfo17isVirtualRegisterEj.llvm.1C4EFC58</font></div><div><font face="monospace, monospace">                  U __PRETTY_FUNCTION__._ZN4llvm18TargetRegisterInfo17isVirtualRegisterEj.llvm.C4B43FD1</font></div><div><font face="monospace, monospace">-                 U __PRETTY_FUNCTION__._ZN4llvm19MachineRegisterInfo20defusechain_iteratorILb0ELb1ELb0ELb1ELb0ELb0EE7advanceEv.llvm.C4B43FD1</font></div><div><font face="monospace, monospace">+                 U __PRETTY_FUNCTION__._ZN4llvm19MachineRegisterInfo20defusechain_iteratorILb0ELb1ELb0ELb1ELb0ELb0EE7advanceEv.llvm.1C4EFC58</font></div><div><font face="monospace, monospace">                  U __PRETTY_FUNCTION__._ZN4llvm19MachineRegisterInfo20getNextOperandForRegEPKNS_14MachineOperandE.llvm.1C4EFC58</font></div><div><font face="monospace, monospace">                  U __PRETTY_FUNCTION__._ZN4llvm19MachineRegisterInfo20getNextOperandForRegEPKNS_14MachineOperandE.llvm.C4B43FD1</font></div><div><font face="monospace, monospace">                  U __PRETTY_FUNCTION__._ZN4llvm19MachineRegisterInfo20getNextOperandForRegEPKNS_14MachineOperandE.llvm.CD79E700</font></div><div><font face="monospace, monospace">@@ -31,6 +31,7 @@</font></div><div><font face="monospace, monospace">                  U __PRETTY_FUNCTION__._ZNK4llvm14ilist_iteratorINS_12ilist_detail12node_optionsINS_12MachineInstrELb1ELb1EvEELb0ELb0EEdeEv.llvm.EEBE0BEA</font></div><div><font face="monospace, monospace">                  U __PRETTY_FUNCTION__._ZNK4llvm14MachineOperand5isDefEv.llvm.1C4EFC58</font></div><div><font face="monospace, monospace">                  U __PRETTY_FUNCTION__._ZNK4llvm14MachineOperand5isDefEv.llvm.CD79E700</font></div><div><font face="monospace, monospace">+                 U __PRETTY_FUNCTION__._ZNK4llvm14MachineOperand5isUseEv.llvm.1C4EFC58</font></div><div><font face="monospace, monospace">                  U __PRETTY_FUNCTION__._ZNK4llvm14MachineOperand5isUseEv.llvm.C4B43FD1</font></div><div><font face="monospace, monospace">                  U __PRETTY_FUNCTION__._ZNK4llvm14MachineOperand6getRegEv.llvm.B5105C7D</font></div><div><font face="monospace, monospace">                  U __PRETTY_FUNCTION__._ZNK4llvm18TargetRegisterInfo11getRegClassEj.llvm.FE201328</font></div><div><font face="monospace, monospace">@@ -39,10 +40,12 @@</font></div><div><font face="monospace, monospace">                  U .str.107.llvm.EEBE0BEA</font></div><div><font face="monospace, monospace">                  U .str.108.llvm.EEBE0BEA</font></div><div><font face="monospace, monospace">                  U .str.110.llvm.1C4EFC58</font></div><div><font face="monospace, monospace">+                 U .str.111.llvm.1C4EFC58</font></div><div><font face="monospace, monospace">                  U .str.112.llvm.1C4EFC58</font></div><div><font face="monospace, monospace">                  U .str.11.llvm.3D3A370D</font></div><div><font face="monospace, monospace">                  U .str.127.llvm.EEBE0BEA</font></div><div><font face="monospace, monospace">                  U .str.134.llvm.1C4EFC58</font></div><div><font face="monospace, monospace">+                 U .str.146.llvm.1C4EFC58</font></div><div><font face="monospace, monospace">                  U .str.14.llvm.C4B43FD1</font></div><div><font face="monospace, monospace">                  U .str.152.llvm.EEBE0BEA</font></div><div><font face="monospace, monospace">                  U .str.15.llvm.C4B43FD1</font></div></div><div><br></div><div>Peter</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 2, 2017 at 6:39 PM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Do you know why it failed? That seems scary if enabling the cache triggers this.<br>
<br>
—<br>
<span class="HOEnZb"><font color="#888888">Mehdi<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> On Mar 2, 2017, at 6:00 PM, Peter Collingbourne via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
><br>
> Author: pcc<br>
> Date: Thu Mar  2 20:00:22 2017<br>
> New Revision: 296850<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=296850&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=296850&view=rev</a><br>
> Log:<br>
> Revert r296730, "cmake: Configure the ThinLTO cache directory when using ELF lld or gold."<br>
><br>
> Causes a build failure on the clang-with-thin-lto-ubuntu bot.<br>
> <a href="http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/2117/steps/build-stage3-compiler/logs/stdio" rel="noreferrer" target="_blank">http://lab.llvm.org:8011/<wbr>builders/clang-with-thin-lto-<wbr>ubuntu/builds/2117/steps/<wbr>build-stage3-compiler/logs/<wbr>stdio</a><br>
><br>
> Modified:<br>
>    llvm/trunk/cmake/modules/<wbr>HandleLLVMOptions.cmake<br>
><br>
> Modified: llvm/trunk/cmake/modules/<wbr>HandleLLVMOptions.cmake<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=296850&r1=296849&r2=296850&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/cmake/<wbr>modules/HandleLLVMOptions.<wbr>cmake?rev=296850&r1=296849&r2=<wbr>296850&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- llvm/trunk/cmake/modules/<wbr>HandleLLVMOptions.cmake (original)<br>
> +++ llvm/trunk/cmake/modules/<wbr>HandleLLVMOptions.cmake Thu Mar  2 20:00:22 2017<br>
> @@ -715,20 +715,11 @@ if(uppercase_LLVM_ENABLE_LTO STREQUAL "T<br>
>   if(NOT LINKER_IS_LLD_LINK)<br>
>     append("-flto=thin" CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)<br>
>   endif()<br>
> -  # If the linker supports it, enable the lto cache. This improves initial build<br>
> -  # time a little since we re-link a lot of the same objects, and significantly<br>
> -  # improves incremental build time.<br>
> -  # FIXME: We should move all this logic into the clang driver.<br>
> -  if(APPLE)<br>
> -    append("-Wl,-cache_path_lto,${<wbr>PROJECT_BINARY_DIR}/lto.cache"<br>
> -           CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)<br>
> -  elseif(UNIX AND LLVM_USE_LINKER STREQUAL "lld")<br>
> -    append("-Wl,--thinlto-cache-<wbr>dir=${PROJECT_BINARY_DIR}/lto.<wbr>cache"<br>
> -           CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)<br>
> -  elseif(LLVM_USE_LINKER STREQUAL "gold")<br>
> -    append("-Wl,--plugin-opt,<wbr>cache-dir=${PROJECT_BINARY_<wbr>DIR}/lto.cache"<br>
> -           CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)<br>
> -  endif()<br>
> +  # On darwin, enable the lto cache. This improves initial build time a little<br>
> +  # since we re-link a lot of the same objects, and significantly improves<br>
> +  # incremental build time.<br>
> +  append_if(APPLE "-Wl,-cache_path_lto,${<wbr>PROJECT_BINARY_DIR}/lto.cache"<br>
> +            CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)<br>
> elseif(uppercase_LLVM_ENABLE_<wbr>LTO STREQUAL "FULL")<br>
>   append("-flto=full" CMAKE_CXX_FLAGS CMAKE_C_FLAGS)<br>
>   if(NOT LINKER_IS_LLD_LINK)<br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div>