[clang] [clang] Remove an incorrect assertion in ConstantFoldAttrs (PR #105789)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 16 06:36:41 PDT 2024
erichkeane wrote:
> > CC @AaronBallman for an opinion about the AST represenation
>
> This is a bit awkward in that it's only used for the `annotate` attributes' argument lists, which should pass all of their arguments down to LLVM IR. However, we don't typically generate LLVM IR for discarded value statements in other circumstances. So I'm not certain _what_ we should pass down to LLVM IR in this case. The arguments could be used positionally, so in that case we'd want to pass _something_ down so the arguments line up to the source. The arguments could be used semantically, so in that case, there's nothing to pass down because there are no semantics.
>
> (CC @erichkeane for more opinions)
My immediate read of this before seeing the discussion was that the positional arguments are important, so making one 'disappear' could be problematic. I think a value of 'None', plus a reasonable IR for that would be our best way forward.
As far as what a 'reasonable IR' for a 'None' value would be, I don't know if we have any viable experts here we can discuss this with. The nature of 'annotate' is that we HAVE no expert on the feature (since it is intended to be used by just about anyone in the backend). I think we'd need to see a codegen test for 'none' however.
So in short:
1- Make it a None ConstantExpr
2- Give that a reasonable output for its attribute in IR
3- Write a codegen test that shows it off
4- Add a release note.
https://github.com/llvm/llvm-project/pull/105789
More information about the cfe-commits
mailing list