[PATCH] D135199: [OpenMP][C++] Allow #pragma omp simd in constexpr functions

Johannes Doerfert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 7 10:49:29 PDT 2022


jdoerfert added inline comments.


================
Comment at: clang/lib/AST/ExprConstant.cpp:8274-8279
     // Only if a local variable was declared in the function currently being
     // evaluated, do we expect to be able to find its value in the current
     // frame. (Otherwise it was likely declared in an enclosing context and
     // could either have a valid evaluatable value (for e.g. a constexpr
     // variable) or be ill-formed (and trigger an appropriate evaluation
     // diagnostic)).
----------------
aaron.ballman wrote:
> jdoerfert wrote:
> > aaron.ballman wrote:
> > > This comment no longer matches the code. It also suggests that the way to address your issue is to capture the variable into the current frame -- did you explore that approach?
> > The problem is that OpenMP introduces artificial capture statements. I am not sure if/how those can be "merged" into the parent context and in general that is not allowed (e.g., as we allow clauses on SIMD, like private). I feel the comment needs updating and I'll try that. 
> Is there a way to limit the change to only OpenMP captured variables so that we're not changing the semantics for all language modes?
I could reasonably guard this to look for -fopenmp if we want to. The variables themselves are probably not easy to identify. I'll look at it again next week in the hope to make more sense of the intermediate frame and maybe avoid this to spill over to other models.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135199



More information about the cfe-commits mailing list