noundef on the return value means that
If the value representation contains any undefined or poison bits, the behavior is undefined.
so if the function returns undef, that must be unreachable.
Alive2 confirms this is allowed: https://alive2.llvm.org/ce/z/bW2DoM
define i32 @src() noundef {
%start:
ret i32 undef
}
=>
define i32 @tgt() noundef {
%start:
assume i1 0
}
Transformation seems to be correct!
But seemingly it doesn't happen today: https://llvm.godbolt.org/z/79a91o59q