[PATCH] D24918: [ADCE] Add code to remove dead branches
David Callahan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 7 09:08:37 PST 2016
david2050 added inline comments.
================
Comment at: lib/Transforms/Scalar/ADCE.cpp:601
+// reverse top-sort order
+void AggressiveDeadCodeElimination::computeReversePostOrder() {
+
----------------
dberlin wrote:
> I think you should just be able to output the PO iterator on Inverse<F> into an array, no?
>
> I would just add
>
> ```
>
> template <class T>
> po_iterator<T> inverse_po_begin(const T &G) { return po_iterator<Inverse<T>>::begin(G); }
> template <class T>
> po_iterator<T> inverse_po_end (const T &G) { return po_iterator<Inverse<T>>::end(G); }
>
> template <class T> iterator_range<po_iterator<T>> inverse_post_order(const T &G) {
> return make_range(inverse_po_begin(G), inverse_po_end(G));
> }
>
> ```
>
> To PostOrderIterator.h
> Then you can just use a nice range loop to fill in the numbers wherever you want them.
>
Thanks for reminding me. These macros already are defined in in the header. We still need the loop to find all nodes without successors right, because there could be multiple returns/
https://reviews.llvm.org/D24918
More information about the llvm-commits
mailing list