[llvm] [IR] Add new function attribute nocreateundeforpoison (PR #164809)
    Jay Foad via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Oct 24 08:23:52 PDT 2025
    
    
  
================
@@ -2741,6 +2741,10 @@ For example:
 ``"nooutline"``
     This attribute indicates that outlining passes should not modify the
     function.
+``nocreateundeforpoison``
+    This attribute indicates that the result of the function will not be undef
+    or poison if all arguments are not undef and not poison. Otherwise, it is
+    undefined behavior.
----------------
jayfoad wrote:
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:
1. Having a `range` attribute on the return value, and returning a value outside that range
1. Having arguments that are poison
1. _Not_ having the `nocreateundeforpoison` attribute
1. ... and so on.
I'm not sure how to explain this succinctly in the LangRef. Maybe I need to invert the description:
```
``nocreateundeforpoison``
    Lack of this attribute indicates that the result of the function may be undef
    or poison even if all arguments are not undef and not poison. Returning
    undef or poison from a function or call site with this attribute triggers
    undefined behavior.
```
Does that help?
https://github.com/llvm/llvm-project/pull/164809
    
    
More information about the llvm-commits
mailing list