]> granicus.if.org Git - llvm/commit
Disable loop unswitching for some patterns containing equality comparison with undef.
authorWei Mi <wmi@google.com>
Tue, 25 Jul 2017 23:37:17 +0000 (23:37 +0000)
committerWei Mi <wmi@google.com>
Tue, 25 Jul 2017 23:37:17 +0000 (23:37 +0000)
commitcedb77eb71613760fe04a2ba4de831effba0569e
treed5c97dd2424b4bc3f75350d67b5d39d3ebeff786
parente22b98a6edd0f1fb911a8c1c0e24c2cfe93286d9
Disable loop unswitching for some patterns containing equality comparison with undef.

This is a workaround for the bug described in PR31652 and
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 loop-unswitching for
them. We also need to disable the select simplification when one of select
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.

Differential Revision: https://reviews.llvm.org/D35811

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309059 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineSelect.cpp
lib/Transforms/Scalar/LoopUnswitch.cpp
test/Transforms/LoopUnswitch/unswitch-equality-undef.ll [new file with mode: 0644]