[PATCH] D136325: [Assignment Tracking Analysis][3/*] Memory location fragment filling

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 9 04:54:01 PST 2022


jmorse added a comment.

I think I've clocked that this is a two-value lattice of \top and \bottom / true and false, indicating "this bit is in memory" or not in memory, and the intersection on meet ensures that it monotonically goes downwards, so we gradually remove bits from being in memory. Which sounds good and correct.

I had a slight concern that insertMemLoc might end up recording a history of what happens during dataflow exploration, instead of determining memory locations once a fixedpoint has been reached. What if we have this:

  entry:
    everything-is-in-memory bits 0-to-127,
    br loophead
  loophead:
    def bits 0-63
    br anotherblock
  anotherblock:
    def bits 64-95
    br i1 %foo loophead, exit
  exit:
    return

After chatting with Orlando elsewhere, it looks like on the first pass through the loop we'll start with bits 0 to 127 being in memory, then:

- On processing loophead, fragment it into being only bits 64 to 127 being in memory,
- Record that fact in BBInsertBeforeMap via insertMemLoc,
- Process anotherblock, now only bits 96 to 127 are in memory,
- Record that fact in BBInsertBeforeMap too,
- Loop back round to loophead,
- meet/merge the interval maps and determine that we have to go through the loop again,
- **Clear** **BBInsertBeforeMap** for loophead,
- Walk through loophead again generating data...
- (etc etc etc)

I'm a lot happier that I understand what's going on now, will check through comment responses...



================
Comment at: llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp:328
+  using InsertMap = MapVector<Instruction *, SmallVector<FragMemLoc>>;
+  DenseMap<const BasicBlock *, InsertMap> BBInsertBeforeMap;
+
----------------
Some commentry on the usage of this data structure appreciated -- specifically the fact that it always records the _last_ (AFAUI) memory/fragment map through a block. I didn't clock that it was repeatedly cleared until much later.


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

https://reviews.llvm.org/D136325



More information about the llvm-commits mailing list