[all-commits] [llvm/llvm-project] 9394c3: [SCCP] Directly remove non-feasible edges

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Jul 23 11:35:39 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9394c3ec881a974afe679467f79a891548eadb89
      https://github.com/llvm/llvm-project/commit/9394c3ec881a974afe679467f79a891548eadb89
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-07-23 (Thu, 23 Jul 2020)

  Changed paths:
    M llvm/lib/Transforms/Scalar/SCCP.cpp
    M llvm/test/Transforms/SCCP/conditions-ranges.ll
    M llvm/test/Transforms/SCCP/predicateinfo-cond.ll
    M llvm/test/Transforms/SCCP/resolvedundefsin-tracked-fn.ll
    M llvm/test/Transforms/SCCP/switch-constantfold-crash.ll
    M llvm/test/Transforms/SCCP/switch.ll
    M llvm/test/Transforms/SCCP/widening.ll

  Log Message:
  -----------
  [SCCP] Directly remove non-feasible edges

Non-feasible control-flow edges are currently removed by replacing
the branch condition with a constant and then calling
ConstantFoldTerminator. This happens in a rather roundabout manner,
by inspecting the users (effectively: predecessors) of unreachable
blocks, and further complicated by the need to explicitly materialize
the condition for "forced" edges. I would like to extend SCCP to
discard switch conditions that are non-feasible based on range
information, but this is incompatible with the current approach
(as there is no single constant we could use.)

Instead, this patch explicitly removes non-feasible edges. It
currently only needs to handle the case where there is a single
feasible edge. The llvm_unreachable() branch will need to be
implemented for the aforementioned switch improvement.

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




More information about the All-commits mailing list