LTO: don't fatal when value for cache key already exists
authorBob Haarman <llvm@inglorion.net>
Fri, 10 Nov 2017 17:08:21 +0000 (17:08 +0000)
committerBob Haarman <llvm@inglorion.net>
Fri, 10 Nov 2017 17:08:21 +0000 (17:08 +0000)
commita17bd121850a7e1c57cd0bd9d7553b35a72f0c39
tree062236c9a350bc0d3ff4cc68a4dbc73b1a817d47
parent8760acb8e39313f6ba4288534560f6ebbc0e9c09
LTO: don't fatal when value for cache key already exists

Summary:
LTO/Caching.cpp uses file rename to atomically set the value for a
cache key. On Windows, this fails when the destination file already
exists. Previously, LLVM would report_fatal_error in such
cases. However, because the old and the new value for the cache key
are supposed to be equivalent, it actually doesn't matter which one we
keep. This change makes it so that failing the rename when an openable
file with the desired name already exists causes us to report success
instead of fataling.

Reviewers: pcc, hans

Subscribers: mehdi_amini, llvm-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D39874

llvm-svn: 317899
llvm/lib/LTO/Caching.cpp