[PATCH] D79527: Correctly modify the CFG in IfConverter, and then remove the CorrectExtraCFGEdges function.

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 16:30:32 PDT 2020


jyknight created this revision.
jyknight added reviewers: qcolombet, efriedma.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

The latter was a workaround for "Various pieces of code" leaving bogus
extra CFG edges in place. Where by "various" it meant only
IfConverter::MergeBlocks, which failed to clear all of the successors
of dead blocks it emptied out. This wouldn't matter a whole lot,
except that the dead blocks remained listed as predecessors of
still-useful blocks, inhibiting optimizations.

This fix slightly changed two thumb tests, because the correct CFG
successors allowed for the "diamond" if-conversion pattern to be
detected, when it could only use "simple" before.

Additionally, the removal of a now-redundant call to analyzeBranch
(with AllowModify=true) in BranchFolder::OptimizeFunction caused a
later check for an empty block in BranchFolder::OptimizeBlock to
fail. Correct this by moving the call to analyzeBranch in
OptimizeBlock higher.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79527

Files:
  llvm/include/llvm/CodeGen/MachineBasicBlock.h
  llvm/lib/CodeGen/BranchFolding.cpp
  llvm/lib/CodeGen/IfConversion.cpp
  llvm/lib/CodeGen/MachineBasicBlock.cpp
  llvm/test/CodeGen/ARM/ifcvt3.ll
  llvm/test/CodeGen/Thumb2/thumb2-ifcvt1.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79527.262496.patch
Type: text/x-patch
Size: 9130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200506/d850d6d4/attachment.bin>


More information about the llvm-commits mailing list