[PATCH] D33003: Add callee-saved registers as implicit uses in return instructions

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 5 08:43:09 PDT 2017


kparzysz added a comment.

In https://reviews.llvm.org/D33003#767147, @MatzeB wrote:

> But factoring this out into the getAllPaths() function feels cumbersome: It requires you to first transform the list of save blocks/restore blocks which is already a nice list into a bitset just so the bitset is iterated again and put into the worklist. Similar with the results: You already visit the relevant blocks but instead of updating the liveins lists you set a bit in the bitset just so that caller has to iterate the bitset again to do something for each visited block.


One of the factors that contributed to this choice was that getting the set of all blocks on paths between two other sets of blocks (e.g. restore blocks and returning blocks) seems like a useful utility to have. The need for calculating this could reasonably arise outside of PEI (I remember needing/wanting this for some work op Hexagon optimizations). It could be placed in another file, but there is no "precedent" for that (we have BasicBlockUtils.h for IR-level blocks, but not for CodeGen).

Regarding the use of BitVector---sure, I can change it to something more universal (any model of a set that can be iterated over would do). BitVector has both: cheap test for membership and iteration, and as a bonus a predictable traversal ordering (based on block numbers).  Copying the argument into another structure (work list) may seem cumbersome, but it would need to happen regardless of what structure is used.

I'll leave the bit vector in for now and address your other comments.


Repository:
  rL LLVM

https://reviews.llvm.org/D33003





More information about the llvm-commits mailing list