[PATCH] D136201: [InstCombine] Handle PHI nodes when eliminating constant memcpy

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 3 03:50:06 PDT 2022


nikic added a comment.

In D136201#3900195 <https://reviews.llvm.org/D136201#3900195>, @gandhi21299 wrote:

> @nikic Since alloca instructions are iterated more than once, shouldn't the `Worklist` under `PointerReplacer` remove instructions that have already been //replaced// (new instruction inserted without removing the old instruction)? The first function goes through a strange transformation when opaque pointers are used, where the `replace(Instruction&)` function is called on a GEP instruction which was already replaced in a previous instruction. This somehow causes the removal of the new GEP instruction.

Not sure I follow, which IR function are you referring to here? Generally InstCombine will automatically clean up dead (side-effect-free) instructions, but it may be possible that this needs to be done explicitly once phis are involved (as they might no longer be trivially dead if there is a cycle).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136201/new/

https://reviews.llvm.org/D136201



More information about the llvm-commits mailing list