[all-commits] [llvm/llvm-project] 857c61: [IPSCCP] Support unfeasible default dests for switch.

Florian Hahn via All-commits all-commits at lists.llvm.org
Tue Apr 26 04:41:56 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 857c612d899f271402470d4026d2e3be1dce53a4
      https://github.com/llvm/llvm-project/commit/857c612d899f271402470d4026d2e3be1dce53a4
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2022-04-26 (Tue, 26 Apr 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/SCCP.cpp
    M llvm/test/Transforms/SCCP/switch-constantfold-crash.ll

  Log Message:
  -----------
  [IPSCCP] Support unfeasible default dests for switch.

At the moment, unfeasible default destinations are not handled properly
in removeNonFeasibleEdges. So far, only unfeasible cases are removed,
but later code expects unreachable blocks to have no predecessors.

This is causing the crash reported in PR49573.

If the default destination is unfeasible it won't be executed. Create
a new unreachable block on demand and use that as default
destination.

Note that at the moment this only is relevant for cases where
resolvedUndefsIn marks the first case as executable. Regular switch
handling has a FIXME/TODO to support determining whether the default
case is feasible or not.

Fixes #48917.

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




More information about the All-commits mailing list