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

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 5 05:22:38 PDT 2022


ABataev added inline comments.


================
Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:6168
   llvm::Value *EVal = CGF.EmitScalarExpr(E);
+  if (auto CI = dyn_cast<llvm::ConstantInt>(EVal))
+    EVal = CGF.Builder.CreateIntCast(
----------------
1. `auto *CI`
2. What if this is not a constant, but just a value with int type? Is this possible?


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:11796
   X = ThenBO->getLHS();
-  D = ThenBO->getRHS();
+  D = ThenBO->getRHS()->IgnoreImpCasts();
 
----------------
Same question as before. It is assignment BO, do you really need to remove casts here?


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:11810
   if (checkIfTwoExprsAreSame(ContextRef, X, BO->getLHS())) {
-    E = BO->getRHS();
+    E = BO->getRHS()->IgnoreImpCasts();
   } else if (checkIfTwoExprsAreSame(ContextRef, X, BO->getRHS())) {
----------------
Maybe, IgnoreImplicitAsWritten?


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