[PATCH] D104445: [SimplifyCFGPass] Tail-merging function-terminating blocks

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 17 03:07:01 PDT 2021


lebedev.ri created this revision.
lebedev.ri added reviewers: fhahn, spatel, nikic, mkazantsev.
lebedev.ri added a project: LLVM.
Herald added subscribers: ormris, wenlei, zzheng, hiraditya.
lebedev.ri requested review of this revision.

Currently, we only tail-merge `ret` function terminators,
which seems to be somewhat overly pessimistic.

This change is meant to be a building block towards sinking more
common code (and yes, i'm interested specifically in doing that
in function terminators, not common block folding in general)
from terminators, potentially de-penalizing inlining.
So this is expected to have a negative impact on both the compile time,
and potentially code size, but as we have established in D101468 <https://reviews.llvm.org/D101468>,
we consider that to be a win.

I haven't updated all the affected codegen tests,
because they are manually written, and updating them will be
a somewhat painful, and long process.

What do people think about this?
One thought i have is that perhaps we actually may want to do
an inverse fold at the end of simplifycfg, i have that change locally,
but i had to post //some// change first :)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104445

Files:
  llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp
  llvm/test/CodeGen/AArch64/branch-relax-cbz.ll
  llvm/test/CodeGen/AArch64/cgp-usubo.ll
  llvm/test/CodeGen/AArch64/implicit-null-check.ll
  llvm/test/CodeGen/AArch64/ldst-opt-after-block-placement.ll
  llvm/test/CodeGen/AArch64/ldst-paired-aliasing.ll
  llvm/test/CodeGen/AArch64/statepoint-call-lowering.ll
  llvm/test/CodeGen/AArch64/use-cr-result-of-dom-icmp-st.ll
  llvm/test/CodeGen/AArch64/vec-extract-branch.ll
  llvm/test/Transforms/LoopUnroll/ARM/upperbound.ll
  llvm/test/Transforms/PGOProfile/chr.ll
  llvm/test/Transforms/PhaseOrdering/X86/simplifycfg-late.ll
  llvm/test/Transforms/PhaseOrdering/X86/vector-reductions.ll
  llvm/test/Transforms/PhaseOrdering/inlining-alignment-assumptions.ll
  llvm/test/Transforms/PruneEH/ipo-nounwind.ll
  llvm/test/Transforms/SimplifyCFG/2003-08-17-FoldSwitch.ll
  llvm/test/Transforms/SimplifyCFG/ConditionalTrappingConstantExpr.ll
  llvm/test/Transforms/SimplifyCFG/DeadSetCC.ll
  llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase-2.ll
  llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase.ll
  llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-no-new-successors.ll
  llvm/test/Transforms/SimplifyCFG/Hexagon/switch-to-lookup-table.ll
  llvm/test/Transforms/SimplifyCFG/HoistCode.ll
  llvm/test/Transforms/SimplifyCFG/SimplifyEqualityComparisonWithOnlyPredecessor-domtree-preservation-edgecase.ll
  llvm/test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll
  llvm/test/Transforms/SimplifyCFG/basictest.ll
  llvm/test/Transforms/SimplifyCFG/branch-fold.ll
  llvm/test/Transforms/SimplifyCFG/duplicate-landingpad.ll
  llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest-two-preds-cost.ll
  llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
  llvm/test/Transforms/SimplifyCFG/guards.ll
  llvm/test/Transforms/SimplifyCFG/hoist-dbgvalue.ll
  llvm/test/Transforms/SimplifyCFG/indirectbr.ll
  llvm/test/Transforms/SimplifyCFG/invoke.ll
  llvm/test/Transforms/SimplifyCFG/pr39807.ll
  llvm/test/Transforms/SimplifyCFG/pr46638.ll
  llvm/test/Transforms/SimplifyCFG/pr48778-sdiv-speculation.ll
  llvm/test/Transforms/SimplifyCFG/preserve-branchweights.ll
  llvm/test/Transforms/SimplifyCFG/rangereduce.ll
  llvm/test/Transforms/SimplifyCFG/suppress-zero-branch-weights.ll
  llvm/test/Transforms/SimplifyCFG/switch-dead-default.ll
  llvm/test/Transforms/SimplifyCFG/switch-masked-bits.ll
  llvm/test/Transforms/SimplifyCFG/switch-on-const-select.ll
  llvm/test/Transforms/SimplifyCFG/switch-range-to-icmp.ll
  llvm/test/Transforms/SimplifyCFG/switch_create-custom-dl.ll
  llvm/test/Transforms/SimplifyCFG/switch_create.ll
  llvm/test/Transforms/SimplifyCFG/switch_switch_fold.ll
  llvm/test/Transforms/SimplifyCFG/switch_thread.ll
  llvm/test/Transforms/SimplifyCFG/tail-merge-noreturn.ll
  llvm/test/Transforms/SimplifyCFG/unprofitable-pr.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104445.352657.patch
Type: text/x-patch
Size: 133385 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210617/f4e9a21b/attachment-0001.bin>


More information about the llvm-commits mailing list