[PATCH] D82316: [LangRef] Add `frozen` attribute to documentation

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 16:40:22 PDT 2020


aqjune added a comment.

`noundef` seems better to me; it is more intuitive.
I'm fine with the suggestion as far as it is added to LangRef that the value is frozen if `noundef` is attached and it isn't an aggregate type with padding bits (if definition is changed as I suggested).



================
Comment at: llvm/docs/LangRef.rst:1259
+    requirement include structures with padding bits, unions with active
+    members smaller than their size, and scalars which were never initialized.
+
----------------
nikic wrote:
> This description is a bit too frontend-centric. I'd suggest to at least add
> 
> > If the parameter is poison or contains undefined bits, the behavior is undefined.
> 
> to describe the actual IR semantic this has.
> 
> Also, can this be applied to return values? If so, it should say so.
For aggregate types, I think it is okay to relax this constraint to allowing aggregates with undef padding bits. It will be great if an aggregate value that is constructed with a chain of `v = insertvalue (insertvalue undef, const1, idx), const2, idx2` can have this attribute attached regardless of whether the aggregate type has paddings or not. Inspecting padding bits which are not accessible without using memory operation may be overly restrictive.
For my previous concern (giving a guarantee that it has no undef bit in memory representation), this should be needed in certain future cases, but not now maybe.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82316





More information about the llvm-commits mailing list