[PATCH] D46100: WIP: [IR/Verifier] Diagnose use-before-def scenarios for debug intrinsics

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 22 10:40:26 PDT 2018


vsk added a comment.

Recently I addressed a dbg.value use-before-def bug in CodeGenPrepare (r340370 <https://reviews.llvm.org/rL340370>). What I learned forced me to reconsider adding this verifier check.

CGP's strategy is to ignore dbg.values until as late as possible. Once it's done optimizing, it simply moves misplaced dbg.values s.t they are dominated by the instructions they reference (see `CodeGenPrepare::placeDebugValues`). This is a simple and correct (iiuc) approach. For maximal benefit, it would only need to be done twice: once before ISel (this is just CGP, so, done!), and again before LiveDebugVariables.

OTOH, if we were to add this verifier check, individual IR/MIR passes would gain some complexity. These passes would either need some equivalent of `placeDebugValues` or need to move dbg.values each time an Instruction is moved. While this would result in improved IR, it wouldn't improve debugging overall. In light of that I suggest abandoning this change.

Let me know what you think.


https://reviews.llvm.org/D46100





More information about the llvm-commits mailing list