This is an archive of the discontinued LLVM Phabricator instance.

UnreachableValue
Needs ReviewPublic

Authored by nicholas on Apr 1 2016, 1:04 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

nicholas updated this revision to Diff 52333.Apr 1 2016, 1:04 AM
nicholas retitled this revision from to UnreachableValue.
nicholas updated this object.
nicholas set the repository for this revision to rL LLVM.
sanjoy added a subscriber: sanjoy.Apr 1 2016, 10:28 PM

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.