[PATCH] D142551: [InstCombine] Teach isDeadPHICycle to look through multiple uses

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 08:06:19 PST 2023


luke created this revision.
luke added reviewers: nikic, spatel.
Herald added subscribers: asb, pmatos, StephenFan, hiraditya.
Herald added a project: All.
luke requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Instead of only detecting trivial cycles which must be a PHI with a single use that's a PHI, which in turn has a single use of the first PHI, generalize it to catch more complex cycles.  This means making it look through all of its uses, as well as looking through arbitrary side-effect free instructions.

The motivation behind this is to enable InstCombiner to remove larger dead PHI cycles in one iteration, to prevent cascading iterations in some pathological cases with lots of dead PHI cycles.

Supersedes D142293 <https://reviews.llvm.org/D142293>
Fixes https://github.com/llvm/llvm-project/issues/50564


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142551

Files:
  llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
  llvm/test/Transforms/InstCombine/fmul-inseltpoison.ll
  llvm/test/Transforms/InstCombine/fmul.ll
  llvm/test/Transforms/InstCombine/phi-dead-cycle-iteration.ll
  llvm/test/Transforms/InstCombine/phi-dead-cycle-side-effect.ll
  llvm/test/Transforms/InstCombine/pr27703.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142551.492117.patch
Type: text/x-patch
Size: 13470 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230125/90916926/attachment.bin>


More information about the llvm-commits mailing list