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

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 08:05:46 PDT 2022


xbolva00 added a comment.

In D123669#3480070 <https://reviews.llvm.org/D123669#3480070>, @psamolysov wrote:

> @nikic
>
>> So, I think it's safe to drop this Visited set in this case, but I would usually consider it good practice to have one, in the interest of defensiveness.
>
> I agree, the code may be changed in the future and the change can be unsafe if the developer won't take into account the idea why the Visited set is not used *now*. I see two ways: to add a comment why using a  `SmallVector` to store the worklist and not using of the Visited set is safe in our case, or to add the Visited set into dead instruction collecting loop in the `doPromotion` function too, for consistency.  What could be better from your point of view?

Is there any other motivation than code simplification?

Better to stay safe IMHO.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123669



More information about the llvm-commits mailing list