[PATCH] D136321: [Assignment Tracking Analysis][2/*] Remove redundant location definitions

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 23 04:46:22 PST 2022


Orlando added a comment.

In D136321#3943496 <https://reviews.llvm.org/D136321#3943496>, @jmorse wrote:

> This is all fine and well; are redundant variable locations a common case and which should we optimise for? IIUC every instruction with debug-info results in a SmallVector copy right now, which isn't necessary if that specific position hasn't had debug-info change. IMO, adding a "ChangedPosition" flag that's used to skip `setWedge` if it isn't true would be beneficial.

In the previous patch I changed `setWedge` to take an r-value reference. I don't have a good feeling as to whether `grow, move, reset` in a loop (growing from the start each time) is more or less performant than `grow, copy, clear` (which is something we could do instead by moving the vector out of the loops). I tried profiling this but on my test case the difference is lost in the noise. I've gone with the `grow, move, reset` version for now to avoid adding a `setWedge` overload but this can always be changed if we find a pathological case. I've added some statistics so we can get a better feel for this "in the wild" and adjust later. The anecdotal results I got for a compiling a single file were about 1% of wedges get modified that seems to support the case for `grow, copy, clear`.


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

https://reviews.llvm.org/D136321



More information about the llvm-commits mailing list