[LICM] Disable thread-safety checks in single-thread model
authorShubham Narlawar <shubham.narlawar@rrlogic.co.in>
Mon, 10 Oct 2022 14:47:14 +0000 (16:47 +0200)
committerNikita Popov <npopov@redhat.com>
Mon, 10 Oct 2022 14:51:16 +0000 (16:51 +0200)
commitb920407cf5957dfd67acece563560141838fc8d8
tree7b8b0d0ccec2c70bc0ded4b1ac287360831c472c
parentdeb82d4a20150b4c983ed02adcfd2ca84691b74b
[LICM] Disable thread-safety checks in single-thread model

If the single-thread model is used, or the
-licm-force-thread-model-single flag is specified, skip checks
related to thread-safety. This means that store promotion for
conditionally executed stores only requires proof of
dereferenceability and writability, but not of thread-safety. For
example, this enables promotion of stores to (non-constant) globals,
as well as captured allocas.

Fixes https://github.com/llvm/llvm-project/issues/50537.

Differential Revision: https://reviews.llvm.org/D130466
llvm/include/llvm/Analysis/TargetTransformInfo.h
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/include/llvm/Transforms/Utils/LoopUtils.h
llvm/lib/Analysis/TargetTransformInfo.cpp
llvm/lib/Transforms/Scalar/LICM.cpp
llvm/test/Transforms/LICM/promote-single-thread.ll