[PATCH] D74642: [CodeGenPrepare] Speed up placeDbgValues, NFC

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 17 13:42:43 PST 2020


vsk added a comment.

In D74642#1878873 <https://reviews.llvm.org/D74642#1878873>, @jmorse wrote:

> LGTM landed whichever way;


I'm hoping we can just land D51664 <https://reviews.llvm.org/D51664> and avoid making this code more complex.

> am I right in thinking that this approach will still be faster than the domtree query even if the block is very large? (On account of the pointer set lookup being ordered, instead of walking through each instruction in a block).

For very large basic blocks, I think this patch might make placeDbgValues a little faster, because the set lookup is theoretically O(1) whereas Instruction::comesBefore is O(n). The worst-case bound is arguably the wrong thing to look at though because a) we'd cache the instruction order, and b) (more speculative) we don't expect to reorder very many debug intrinsics within a block? Note that not all reordering invalidates the instruction order because Reid made removeFromParent() preserve the order.


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

https://reviews.llvm.org/D74642





More information about the llvm-commits mailing list