[IRBuilder] Handle constexpr-bitcast for IRBuilder::CreateThreadLocalAddress
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>
Wed, 3 Aug 2022 03:11:27 +0000 (11:11 +0800)
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>
Wed, 3 Aug 2022 03:13:49 +0000 (11:13 +0800)
commitce1b24cca886eb9f05e252f399059167473d0ba3
tree5e4868bc06d50b64774c602f8f52ea1483526c6b
parentd8602bcdfa653d1beef1070a8ce7bb8a77bb316e
[IRBuilder] Handle constexpr-bitcast for IRBuilder::CreateThreadLocalAddress

In case that opaque pointers not enabled, there may be some constexpr
bitcast uses for thread local variables and the design of llvm allow
people to sink constant arbitrarily. This breaks the assumption of
IRBuilder::CreateThreadLocalAddress. This patch tries to handle the
case.
llvm/lib/IR/IRBuilder.cpp
llvm/unittests/IR/IRBuilderTest.cpp