[PATCH] D40699: Split IndirectBr critical edges before PGO gen/use passes.

Hiroshi Yamauchi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 18:13:00 PST 2017


yamauchi created this revision.
Herald added a subscriber: mehdi_amini.

The PGO gen/use passes currently fail with an assert failure if there's a
critical edge whose source is an IndirectBr instruction.

To avoid this in certain cases (splitting an IndirectBr critical edge isn't
always possible), add a pass that splits IndirectBr critical edges before the
PGO gen/use passes.

We use a separate pass rather than during the PGO gen/use passes because it
would involve changing the CFG more significantly than a normal critical edge
and invalidate the BPI/BFI/MST.

splitIndirectCriticalEdges() is moved from CodeGenPrepare.cpp to
BreakCriticalEdges.cpp and is shared by CodeGenPrepare and the above pass.


https://reviews.llvm.org/D40699

Files:
  include/llvm/InitializePasses.h
  include/llvm/LinkAllPasses.h
  include/llvm/Transforms/Instrumentation.h
  include/llvm/Transforms/PGOInstrumentation.h
  include/llvm/Transforms/Utils/BasicBlockUtils.h
  lib/CodeGen/CodeGenPrepare.cpp
  lib/Passes/PassBuilder.cpp
  lib/Passes/PassRegistry.def
  lib/Transforms/IPO/PassManagerBuilder.cpp
  lib/Transforms/Instrumentation/PGOInstrumentation.cpp
  lib/Transforms/Utils/BreakCriticalEdges.cpp
  test/Transforms/PGOProfile/split-indirectbr-critical-edges.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40699.125068.patch
Type: text/x-patch
Size: 25660 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171201/3f5b996b/attachment.bin>


More information about the llvm-commits mailing list