[PATCH] D115437: [GVN] Try to use an equivalent PHI after constructing one for load set

Dmitry Makogon via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 9 03:09:42 PST 2021


dmakogon created this revision.
dmakogon added reviewers: mkazantsev, reames, fhahn, nikic.
Herald added a subscriber: hiraditya.
dmakogon requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

With this patch GVN looks for an equivalent PHI after it inserts one
for load set. If such PHI is found, it's used instead of the inserted one.
We say the PHI that should replace the load is equivalent to some other PHI
simply if their incoming values match. But if the incoming values
are binary operators, we do a special check: we assume that the load
operand of an operator is equal to the PHI we are checking against 
(we can do this, because we are asked whether this inserted PHI is equivalent
to some other one and we know that the load is equivalent to the
inserted PHI).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115437

Files:
  llvm/lib/Transforms/Scalar/GVN.cpp
  llvm/test/Transforms/GVN/duplicate-phis.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115437.393086.patch
Type: text/x-patch
Size: 6087 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211209/1568e8c5/attachment-0001.bin>


More information about the llvm-commits mailing list