[PATCH] D104598: [NFCI-ish][SimplifyCFGPass] Rework and generalize `ret` block tail-merging

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 19 14:17:52 PDT 2021


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

This changes the approach taken to tail-merge the blocks
to always create a new block instead of trying to reuse some block,
and generalizes it to support dealing not with just the `ret` in the future.

This effectively lifts the CallBr restriction, although this isn't really intentional.
That showed that we miscompile blocks with their addresses taken in at least two places,
so two fixes had to be applied.

Other restrictions of the transform remain.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104598

Files:
  llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp
  llvm/test/Transforms/LoopUnroll/ARM/upperbound.ll
  llvm/test/Transforms/SimplifyCFG/2003-08-17-FoldSwitch.ll
  llvm/test/Transforms/SimplifyCFG/ConditionalTrappingConstantExpr.ll
  llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase.ll
  llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-no-new-successors.ll
  llvm/test/Transforms/SimplifyCFG/SimplifyEqualityComparisonWithOnlyPredecessor-domtree-preservation-edgecase.ll
  llvm/test/Transforms/SimplifyCFG/basictest.ll
  llvm/test/Transforms/SimplifyCFG/hoist-dbgvalue.ll
  llvm/test/Transforms/SimplifyCFG/pr48778-sdiv-speculation.ll
  llvm/test/Transforms/SimplifyCFG/rangereduce.ll
  llvm/test/Transforms/SimplifyCFG/suppress-zero-branch-weights.ll
  llvm/test/Transforms/SimplifyCFG/switch-masked-bits.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104598.353210.patch
Type: text/x-patch
Size: 36251 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210619/bfe62d21/attachment.bin>


More information about the llvm-commits mailing list