[PATCH] D130466: [LICM] - Add option to allow data races

Shubham Narlawar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 04:18:13 PDT 2022


gsocshubham added a comment.

In D130466#3726690 <https://reviews.llvm.org/D130466#3726690>, @efriedma wrote:

> The ThreadModel is passed from clang->LLVM; see llvm/include/llvm/Target/TargetOptions.h
>
> Most interesting parts of TargetTransformInfo are implemented in llvm/include/llvm/CodeGen/BasicTTIImpl.h .  In there, you should be able to go from TargetLowering->TargetMachine->TargetOptions, or something like that.

Makes sense.

One can get TargetOptions using - `TargetLowering->getTargetMachine()->DefaultOptions->ThreadModel` where DefaultOptions is TargetOptions only if TargetLowering is available in LICM.

1. Getting TargetLowering or TargetMachine in LICM does not seem pretty straight forward/directly available in LICM which implies there seems no way to know Thread Model in LICM.

-> In LICM, we have `TargetTransformInfo` and `TargetLibraryInfo` but again it does not fetch `TargetLowering/TargetOptions` in any way.

2. The current implementation seems complete as per https://github.com/llvm/llvm-project/issues/50537 in which there is option `-licm-force-thread-model-single` if the target supports thread model single.

3. We pass thread model from clang to licm which enables this transformation when thread model is single.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130466/new/

https://reviews.llvm.org/D130466



More information about the llvm-commits mailing list