This is a workaround for the bug described in http://lists.llvm.org/pipermail/llvm-dev/2017-July/115497.html. The temporary solution is to add a function EqualityPropUnSafe. In EqualityPropUnSafe, for some simple patterns we can know the equality comparison may contains undef, so we regard such comparison as unsafe and will not do do-unswitching for them. We also need to disable the select simplification when one of its operand is undef and its result feeds into equality comparison.
The patch cannot clear the safety issue caused by the bug, but it can suppress the issue from happening to some extent.
I think the change may have little performance impact. For the change to disable select simplification, I tried spec2000 and spec2006, the related path is never taken. For llvm bootstrap, it is taken only four times.
Is it better to document the bug number here?