[PATCH] D158064: [IR] Add PHINode::removeIncomingValueIf() (NFC)

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 02:58:50 PDT 2023


nikic created this revision.
nikic added a reviewer: efriedma.
Herald added subscribers: Enna1, StephenFan, hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Add an API that allows removing multiple incoming phi values based on a predicate callback, as suggested on D157621 <https://reviews.llvm.org/D157621>.

This makes sure that the removal is linear time rather than quadratic, and avoids subtleties around iterator invalidation.

I have replaced some of the more straightforward users with the new API, though there's a couple more places that should be able to use it.


https://reviews.llvm.org/D158064

Files:
  llvm/include/llvm/IR/Instructions.h
  llvm/lib/IR/Instructions.cpp
  llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
  llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
  llvm/lib/Transforms/Utils/LoopSimplify.cpp
  llvm/lib/Transforms/Utils/LoopUtils.cpp
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158064.550684.patch
Type: text/x-patch
Size: 7055 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230816/148898c0/attachment.bin>


More information about the llvm-commits mailing list