[PATCH] D127109: llvm-reduce: Don't assert on functions which don't track liveness

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 6 12:07:47 PDT 2022


MatzeB added a comment.

The background for this property is that we only really compute the livein lists at the end of register allocation (in the VirtRegRewriter or FastRegAlloc). Before that point using the liveins is pretty much always wrong because they are not complete/correct.

Unfortunately the live-ins are also used to model the unusual case for exception handling: Unwinding from a call appears like a jump on the control flow graph; unfortunately contrary to all the other jumps in a CFG the unwinding logic executes real code and happens to set a register to a new value that we want to read in the target block. This puts us into the odd position that we need to model this register being set, but doing so at the end of the predecessor block is wrong and will unnecessarily increase pressure for the non-exception cases, doing at the beginning of the target block is wrong, because the register may not be set when there's multiple predecessor in the target. Setting a register "on" a CFG edge isn't really something we can model. So instead we do this "hack" where we insert the register into the live-in list of the target...

I don't remember the details, but I think I added the `assert` to all the normal accessor functions to protect people from relying on the live-in information when they shouldn't, but there was at least 1 way to read the live-ins anyway if you really needed to check for that exception handling special case...


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

https://reviews.llvm.org/D127109



More information about the llvm-commits mailing list