[PATCH] D120290: [Clang][OpenMP] Add the codegen support for `atomic compare capture`

Shilei Tian via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 18 12:14:52 PDT 2022


tianshilei1992 added inline comments.


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:11663
   X = BO->getLHS();
-  D = BO->getRHS();
+  D = BO->getRHS()->IgnoreImpCasts();
 
----------------
ABataev wrote:
> Why do we need to use `IgnoreImpCasts()` here and in other places?
Clang usually inserts implicit casts. For example, if we have:
```
char a, b, c;
#pragma omp atomic compare capture
  { r = a; if (a > c) { a = b; } }
```
Clang inserts an implicit cast from `char` to `int` for all statements except `r = a`. In this case, what should be the right solution? I'm not quite sure actually.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120290



More information about the cfe-commits mailing list