[PATCH] D84264: [SCCP] Directly remove non-feasible edges

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 21 13:10:34 PDT 2020


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

Non-feasible control-flow edges are currently removed by replacing the branch condition with a constant and then calling ConstantFoldTerminator. This happens in a rather roundabout manner, by inspecting the users (effectively: predecessors) of unreachable blocks, and further complicated by the need to explicitly materialize the condition for "forced" edges. I would like to extend SCCP to discard switch conditions that are non-feasible based on range information, but this is incompatible with the current approach (as there is no single constant we could use.)

Instead, this patch explicitly removes non-feasible edges. It currently only handles the case where there is a single feasible edge. The llvm_unreachable() branch will need to be implemented for the aforementioned switch improvement.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84264

Files:
  llvm/lib/Transforms/Scalar/SCCP.cpp
  llvm/test/Transforms/SCCP/conditions-ranges.ll
  llvm/test/Transforms/SCCP/resolvedundefsin-tracked-fn.ll
  llvm/test/Transforms/SCCP/switch-constantfold-crash.ll
  llvm/test/Transforms/SCCP/widening.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84264.279614.patch
Type: text/x-patch
Size: 11604 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200721/0d3a45ed/attachment.bin>


More information about the llvm-commits mailing list