[llvm-commits] [Patch] Make GlobalOpt conservative with TLS vars (PR14309, 3.2-blocker)

Hans Wennborg hans at chromium.org
Mon Nov 12 08:20:37 PST 2012


Hi all,

The attached patch takes a stab at fixing PR14309 which was marked as
a 3.2-blocker.

For global variables which get the same value stored into them
everywhere, GlobalOpt will replace them with a constant. The problem
is that a thread-local GlobalVariable looks like one value, but is
different between threads.

My patch introduces Constant::isThreadDependent() which returns true
for thread-local variables and constants which depend on them (e.g. a
GEP into a thread-local array), and teaches GlobalOpt not to track
such values.

Please take a look!

Also, if anyone thinks there are more passes which assume that
thread-local GlobalVariables have the same value everywhere, please
let me know.

Thanks,
Hans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr14309_tls_globalopt.diff
Type: application/octet-stream
Size: 4393 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121112/054912c9/attachment.obj>


More information about the llvm-commits mailing list