[SCCP] Simplify CFG in SCCP as well
authorNikita Popov <npopov@redhat.com>
Mon, 27 Jun 2022 15:14:41 +0000 (17:14 +0200)
committerNikita Popov <npopov@redhat.com>
Thu, 30 Jun 2022 07:25:03 +0000 (09:25 +0200)
commit10c531cd5bf0166ce5bf42736506733b2285fdf8
tree40953b0c0e18a29ecd8e1494b81a664208c7a9d0
parent1e55ec6666fa687b1a86bdaa95ea814557855fd1
[SCCP] Simplify CFG in SCCP as well

Currently, we only remove dead blocks and non-feasible edges in
IPSCCP, but not in SCCP. I'm not aware of any strong reason for
that difference, so this patch updates SCCP to perform the CFG
cleanup as well.

Compile-time impact seems to be pretty minimal, in the 0.05%
geomean range on CTMark.

For the test case from https://reviews.llvm.org/D126962#3611579
the result after -sccp now looks like this:

    define void @test(i1 %c) {
    entry:
      br i1 %c, label %unreachable, label %next
    next:
      unreachable
    unreachable:
      call void @bar()
      unreachable
    }

-jump-threading does nothing on this, but -simplifycfg will produce
the optimal result.

Differential Revision: https://reviews.llvm.org/D128796
llvm/lib/Transforms/Scalar/SCCP.cpp
llvm/test/Transforms/GVN/gvn-loop-load-pre-order.ll
llvm/test/Transforms/SCCP/2004-12-10-UndefBranchBug.ll
llvm/test/Transforms/SCCP/2008-01-27-UndefCorrelate.ll
llvm/test/Transforms/SCCP/preserve-analysis.ll
llvm/test/Transforms/SCCP/sccptest.ll
llvm/test/Transforms/SCCP/strictfp-phis-fcmp.ll
llvm/test/Transforms/SCCP/strictfp-phis-fcmps.ll
llvm/test/Transforms/SCCP/widening.ll