[PATCH] D37463: Fix miscompile in LoopSink pass
Daniil Suchkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 5 03:38:59 PDT 2017
DaniilSuchkov created this revision.
It was allowed by `llvm::canSinkOrHoistInst` to sink non-invariant loads into loops but it is illegal because it can introduce new data races. For example:
b = *p;
for (int i = 0; i < N; i++)
a[i] = b;
Assuming `a` is a thread local value, it should always contain a single value. If it were to contain different values at different indices, that would be a miscompile.
Repository:
rL LLVM
https://reviews.llvm.org/D37463
Files:
lib/Transforms/Scalar/LICM.cpp
test/Transforms/LICM/loopsink.ll
test/Transforms/LICM/sink.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37463.113818.patch
Type: text/x-patch
Size: 5877 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170905/9cfb0d15/attachment.bin>
More information about the llvm-commits
mailing list