[RFC] Assignment tracking: A better way of specifying variable locations in IR

Oh, and the final patch (⚙ D132226 [Assignment Tracking][7/*] Add assignment tracking functionality to clang) contains a C++ to IR test which may be useful to look at to get an idea of what this looks like in practice.

sitrep: patches numbered 8 through to 24 in the same stack are the middle-end changes required for assignment tracking.

There are a few patches with trivial changes in that range, e.g. D133311.

The following are probably the more interesting ones to look at:

⚙ D133291 [Assignment Tracking][8/*] Add DIAssignID merging utilities,
⚙ D133292 [Assignment Tracking][9/*] Don't drop DIAssignID in dropUnknownNonDebugMetadata,
⚙ D133295 [Assignment Tracking][12/*] Account for assignment tracking in mem2reg,
⚙ D133296 [Assignment Tracking][13/*] Account for assignment tracking in SROA,
⚙ D133310 [Assignment Tracking][15/*] Account for assignment tracking in simplifycfg,
⚙ D133318 [Assignment Tracking][21/*] Account for assignment tracking in inliner,

As mentioned in ⚙ D133321 [Assignment Tracking][24/*] Always RemoveRedundantDbgInstrs in instcombine in assignment tracking builds, when building CTMark’s tramp3d-v4 (with -emit-llvm and RelWithDebInfo flags) with this patch stack the peak memory consumption increases by just under 1.5% when assignment tracking is enabled, and the run time difference (of the compiler) is negligible.

The next and final patch set will be lowering assignment tracking metadata to standard MIR debug instructions.

I’ve omitted a few patches that are redundant if we can solve the issue I mention here Auto-undef debug uses of a deleted value

sitrep: the final patches to make Things Work are now on phabricator. The ones that are not just NFC / refactoring in preparation are:






Next steps

I plan to start landing the NFC and refactoring patches, followed by slowly landing the accepted assignment tracking patches (assignment tracking is disabled by default and must explicitly be enabled using -Xclang -fexperimental-assignment-tracking).

There’s still work to do (see TODO list in D132220) and likely some ironing out of bugs.

@OCHyams, thanks for all your work on this so far! :slightly_smiling_face: Are those final patches ready for review? There aren’t any reviewers set, so I wasn’t sure…

Hi @jryans, yes I they are ready for review, thanks for checking. I wasn’t sure who to add to review these - any and all comments would be very welcome!