[PATCH] D71678: [ConstantHoisting] Ignore unreachable bb:s when collecting candidates

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 18 14:00:38 PST 2019


bjope created this revision.
bjope added a reviewer: spatel.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Ignore looking at blocks that are unreachable from entry when
collecting candidates for hosting.

Normally the consthoist pass is executed in the llc pipeline,
just after unreachableblockelim. So it is abnormal to have code
that is unreachable from the entry block. But when running the
pass as part of opt, for example as part of fuzzy testing, we
might trigger various kinds of asserts when collecting candidates
if we include unreachable blocks in that analysis.

Since it also just is a waste of time trying to hoist constants
in unreachble code, the simple solution is to simply ignore such
blocks when collecting the hoisting candidates.

The two added test cases used to end up in two different asserts,
and the intention with the checks is just to verify that we no
longer fail.

Fixes: PR43903


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71678

Files:
  llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
  llvm/test/Transforms/ConstantHoisting/AArch64/consthoist-unreachable.ll
  llvm/test/Transforms/ConstantHoisting/X86/pr43903-not-all-uses-rebased.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71678.234613.patch
Type: text/x-patch
Size: 5893 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191218/21eec1a6/attachment.bin>


More information about the llvm-commits mailing list