jdoerfert added a comment.

In D91944#2457744 <https://reviews.llvm.org/D91944#2457744>, @dreachem wrote:

> In D91944#2414364 <https://reviews.llvm.org/D91944#2414364>, @jdoerfert wrote:
>
>> This looks close to an OpenMP 5.0 implementation. I left comments inlined.
>>
>> We need tests that show how non-selected alternatives *do not* impact the 
>> program. As an example, a template instantiation inside of a non-selected 
>> alternative is not actually performed.
>>
>> We also need test with ill-formed metadirectives.
>
> @jdoerfert I'm still trying to understand this thing regarding template 
> instantiations.

The problem is this patch can only resolve to a single directive during 
parsing. Take

  template<bool b>
  void foo() {
    #pragma omp metadirective when(user={condition(b)}) ...
  }

which is not resolvable at parsing time but it is a valid OpenMP 5.0 use of the 
metadirective
that needs to resolve at compile time.

> The spec says that a directive variant associated with a when clause can only 
> affect the program if it is a dynamic replacement candidate. I had assumed 
> this is referring to the runtime behavior of the program, and not (for 
> instance) whether a compiler error is emitted due to a failing static assert.

I always assume(d) that static_assert is something "affecting the program". It 
doesn't matter though because if you instantiate all the clauses eagerly you 
change things for the runtime as well, e.g., you can cause different template 
instances to be selected later on depending on earlier instantiations. So it's 
not "just" static_assert.

> Also, in order to determine what are the dynamic replacement candidates, and 
> their order, all specified score expressions would need to be evaluated.  
> Then, you'd need to evaluate the static context selectors, in decreasing 
> order of their score, to find which one is the last dynamic replacement 
> candidate. So I think template instantiations could be possible for those 
> expressions, even if the corresponding variants aren't selected?

Yes, we will always evaluate selectors and scores. The key is that we won't 
evaluate the directive variant, which is neither a selector nor a score.

I hope this makes sense.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91944

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to