[PATCH] D68924: CodeExtractor: NFC: Use Range based loop

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 13:06:22 PDT 2019


tejohnson accepted this revision.
tejohnson added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/Transforms/Utils/CodeExtractor.cpp:963
   // blocks were originally in the code region.
   std::vector<User *> Users(header->user_begin(), header->user_end());
+  for (auto &U : Users)
----------------
tejohnson wrote:
> You can use a range iterator over the users accessed from header directly, rather than creating a vector:
> 
> for (auto &U : header->users())
> 
> Looks like the code earlier at line 944-5 can be transformed similarly
I missed the fact that the below loop is modifying the users list, so you can ignore my suggestion.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68924





More information about the llvm-commits mailing list