[PATCH] D63913: [JumpThreading] Fix threading with unusual PHI nodes.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 17:53:58 PDT 2019


efriedma created this revision.
efriedma added reviewers: hfinkel, craig.topper, davide.
Herald added a subscriber: jfb.
Herald added a project: LLVM.

If the block being cloned contains a PHI node, in general, we need to clone that PHI node, even though it's trivial. If the operand of the PHI is an instruction in the block being cloned, the correct value for the operand doesn't exist until SSAUpdater constructs it.

We usually don't hit this issue because we try to avoid threading across loop headers, but it's possible to hit this in some cases involving irreducible CFGs.  I added a flag to allow threading across loop headers to make the testcase simpler.

Thanks to Brian Rzycki for reducing the testcase.

Fixes https://bugs.llvm.org/show_bug.cgi?id=42085.


Repository:
  rL LLVM

https://reviews.llvm.org/D63913

Files:
  lib/Transforms/Scalar/JumpThreading.cpp
  test/Transforms/JumpThreading/loop-phi.ll
  test/Transforms/JumpThreading/lvi-tristate.ll
  test/Transforms/JumpThreading/select.ll
  test/Transforms/JumpThreading/thread-loads.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63913.206977.patch
Type: text/x-patch
Size: 6866 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190628/2429363c/attachment.bin>


More information about the llvm-commits mailing list