-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[IR] Add new function attribute nocreateundeforpoison #164809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
ac95b57
40a3c93
bf32374
8652177
ab58489
5657809
2477738
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -449,7 +449,7 @@ def int_amdgcn_log_clamp : DefaultAttrsIntrinsic< | |
|
|
||
| def int_amdgcn_fmul_legacy : ClangBuiltin<"__builtin_amdgcn_fmul_legacy">, | ||
| DefaultAttrsIntrinsic<[llvm_float_ty], [llvm_float_ty, llvm_float_ty], | ||
| [IntrNoMem, IntrSpeculatable, Commutative] | ||
| [IntrNoMem, IntrSpeculatable, Commutative, IntrNoCreateUndefOrPoison] | ||
|
||
| >; | ||
|
|
||
| // Fused single-precision multiply-add with legacy behaviour for the multiply, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to clarify the interaction with fast math flags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I'm not sure exactly how to word it. How about:
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, something like that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But same applies for other poison-generating metadata and attributes like
rangeand!rangeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the interaction with other attributes: I do not want to come up with an order of precedence of attributes, saying which ones take priority over other ones, and I do not think it is necessary. The way I understand it is there are a bunch of reasons why a call might return poison, including:
rangeattribute on the return value, and returning a value outside that rangenocreateundeforpoisonattributeI'm not sure how to explain this succinctly in the LangRef. Maybe I need to invert the description:
Does that help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think phrasing it in terms of what it doesn't mean is worse. Can we phrase it in terms of... base value behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean by "base value" and I don't see that term used elsewhere. Are you suggesting we separate out the callee's internal view of the return value and the caller's external view of it? (Like "intensional" and "extensional" definitions in logic/semantics.)
nocreateundeforpoisonsays something about the internal view. Poison-generating attributes and fast math flags only affect the external view, e.g.nnansays that if the internal is NaN then the external is poison.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think something like this would be fine? "This attribute indicates that the result of the function (prior to application of return attributes/metadata) will not be undef or poison if all arguments are not undef and not poison."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I used that.