Add "unreachable constants". An unreachable constant is used to indicate that the evaluation of a constant expression would trap. An instruction that produces an unreachable constant has no defined semantics.
Details
Details
- Reviewers
- None
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Hi Nick,
As mentioned on the email thread, unreachable looks a lot like
poison, and I suspect it has the same kinds of issues:
- In the context of unreachable, is select strict or lazy in its non-condition arguments? IOW is select false, unreachable, 42 == 42 or == unreachable. If the former, then select s cannot be folded into arithmetic; if the latter then br - phi pairs cannot be folded into selects.
- Since we optimize select C, X, undef to X, with your patch it is possible for LLVM to substitute undef with unreachable. If we want unreachable to be "stronger" than undef (in that, it should allow more aggressive optimizations), then that optimization needs to be removed.