[PATCH] D123669: [ArgPromotion] Use SmallSetVector to traverse values

Pavel Samolysov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 04:23:53 PDT 2022


psamolysov created this revision.
psamolysov added reviewers: chandlerc, nikic, silvas, antoniofrighetto, rriddle, beanz.
psamolysov added a project: LLVM.
Herald added subscribers: ormris, dexonsmith, hiraditya.
Herald added a project: All.
psamolysov requested review of this revision.
Herald added a subscriber: llvm-commits.

To look at all the loads of the argument in the 'findArgParts' function,
a pair of a SmallVector for the Worklist and a SmallPtrSet to store the
visited values is used. The pair can be replaced with an instance of the
SmallSetVector class to simplify the code.

Being introduced in STLExtras, the function 'insert_range' can be used
as a replacement of the lambda AppendUsers to insert the range of users
of every visited variable to the Worklist, an instance of the
SmallSetVector class.

In contrast to the 'append_range' function that inserts the values from the
range argument in the container starting at the end, the 'insert_range'
one inserts the values in associative containers, 'SmallSetVector' for
example, using no hints (some LLVM's associative containers don't
support insertion hints unlike the STL's ones) to specify where to insert
them.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123669

Files:
  llvm/include/llvm/ADT/STLExtras.h
  llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
  llvm/unittests/ADT/STLExtrasTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123669.422465.patch
Type: text/x-patch
Size: 3211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220413/01c1abe8/attachment.bin>


More information about the llvm-commits mailing list