[PATCH] D158849: [GVN] Invalidate MDA when deduplicating phi nodes

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 25 07:54:21 PDT 2023


nikic created this revision.
nikic added reviewers: fhahn, asbirlea, Carrot.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Duplicate phi nodes were being directly removed, without invalidating MDA. This could result in a new phi node being allocated at the same address, incorrectly reusing a cache entry.

Fix this by optionally allowing EliminateDuplicatePHINodes() to collect phi nodes to remove into a vector, which allows GVN to handle removal itself.

Fixes https://github.com/llvm/llvm-project/issues/64598.


https://reviews.llvm.org/D158849

Files:
  llvm/include/llvm/Transforms/Utils/Local.h
  llvm/lib/Transforms/Scalar/GVN.cpp
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/test/Transforms/GVN/pr64598.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158849.553475.patch
Type: text/x-patch
Size: 10822 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230825/42ccd62a/attachment.bin>


More information about the llvm-commits mailing list