[all-commits] [llvm/llvm-project] 89e3bb: [ConstantHoisting] Ignore unreachable bb:s when co...

Björn Pettersson via All-commits all-commits at lists.llvm.org
Thu Dec 19 06:13:43 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 89e3bb4502631543e648cd387405004850871af0
      https://github.com/llvm/llvm-project/commit/89e3bb4502631543e648cd387405004850871af0
  Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2019-12-19 (Thu, 19 Dec 2019)

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

  Log Message:
  -----------
  [ConstantHoisting] Ignore unreachable bb:s when collecting candidates

Summary:
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.

It seems like a waste of time to hoist constants in unreachble
blocks, so the 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

Reviewers: spatel

Reviewed By: spatel

Subscribers: hiraditya, uabelho, llvm-commits

Tags: #llvm

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




More information about the All-commits mailing list