Wouldn’t it be more pragmatic to define Any/Undefined with NaN as truly undefined (immediate UB or poison)? If we expect the lowering target to be able to detect NaN, then it could always expand minf/maxf if it does not provide a matching Propagate* ops. This should work for SPIR-V/GLSL.
That feels equivalent to have Unknown being setting the “input won’t be NaN” fastmath flag, which doesn’t seem right. I’d think “there exists a consistent semantics, but we don’t know what they are” is more useful than poison.
I think we have to be extra clear and careful when deciding what ‘consistent semantics’ mean for Unknown/Undefined. Based on:
I understood that:
It’s either PropagateNaN or PropagateOtherglobally in the whole module.
minf/maxf are Pure (speculatable, no implicit memory effects)
Duplication, CSE, DCE are all fine. This should not fail:
We can only constant-fold when we know arguments to be non-NaN.
Without either a strict notion of consistency or disallowing NaN arguments, I don’t see how we would be able to do basic transformations like scalarization, vectorization, loop unrolling, etc.