[PATCH] D70749: [InstCombine] do not insert nonnull assumption for undef
Nuno Lopes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 4 01:39:43 PST 2019
nlopes added a comment.
In D70749#1767639 <https://reviews.llvm.org/D70749#1767639>, @jdoerfert wrote:
> You said "Changing the semantics on non-respecting the tags from UB to poison doesn't help either.", could you elaborate why?
> If there are no uses of a violating instantiation (undef/null passed to a non-null) we would not get UB but an unused poison value.
The issue I had in mind was a function call where the return value is actually used. e.g.:
x = foo(nonnull ptr)
->
x = foo(nonnull undef)
With the current semantics, we introduce UB. If changed to "the function returns poison", then `x` would change from a regular value to poison, also incorrect.
---
Just to add to the attribute stripping issue, see this example:
define @foo(nonnull)
x = @foo(nonnull %ptr)
->
x = @foo(%ptr)
Dropping `nonnull` from the call site doesn't help because we inherit it from the callee definition. We can only go this way if we guarantee we have a strong way of stripping attributes from definitions (as @efriedma mentioned). I don't think that's guaranteed in linking ATM, but if so, problem solved :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70749/new/
https://reviews.llvm.org/D70749
More information about the llvm-commits
mailing list