15 Commits

Author SHA1 Message Date
Orlando Cazalet-Hyams
e7547b25f5
[KeyInstr][DwarfDebug] Add is_stmt emission support (#133495)
Interpret Key Instructions metadata to determine is_stmt placement.

The lowest rank (highest precedent) instructions in each {InlinedAt, atomGroup}
set are candidates for is_stmt. Only the last instruction in each set in a given
block gets is_stmt. Calls always get is_stmt.

RFC: https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
2025-05-13 17:26:21 +01:00
Orlando Cazalet-Hyams
fb7d114efb
[KeyInstr][LoopUnswitch] Remap cloned instructions' atoms (#133491)
RFC: https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
2025-05-09 15:24:47 +01:00
Orlando Cazalet-Hyams
40ac25e309
[KeyInstr][JumpThreading] Remap atoms after threading (#133487)
RFC: https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
2025-05-09 13:48:23 +01:00
Orlando Cazalet-Hyams
c453da7b7c
[KeyInstr][LoopUnroll] Remap atoms while unrolling (#133489)
RFC: https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
2025-05-09 13:47:16 +01:00
Orlando Cazalet-Hyams
8fa3b52ac4
[KeyInstr] Remap cloned PHIs in BreakCriticalEdges (#133493)
RFC: https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
2025-05-08 13:46:53 +01:00
Orlando Cazalet-Hyams
fc2ec06cca
[KeyInstr] Add MIR parser support (#133494)
RFC: https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
2025-05-08 10:40:21 +01:00
Orlando Cazalet-Hyams
6a1f52150a
[KeyInstr][LoopRotate] Remap atoms of duplicated instructions (#133490)
RFC: https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
2025-05-07 17:10:30 +01:00
Orlando Cazalet-Hyams
960221623f
[KeyInstr][JumpThreading] Remap atoms duping bb with cond br on phi into pred (#133488)
See test for details.
2025-05-07 16:01:53 +01:00
Orlando Cazalet-Hyams
a061998a14
[KeyInstr][JumpThreading] Remap atoms in blocks duplicated for threading (#133486) 2025-05-07 14:54:04 +01:00
Orlando Cazalet-Hyams
5be080edf7
[KeyInstr][Inline] Don't propagate atoms to inlined nodebug instructions (#133485)
RFC: https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
2025-05-07 11:54:57 +01:00
Orlando Cazalet-Hyams
74c3025dd5
[KeyInstr][SimplifyCFG] Remap atoms after duplication for threading (#133484)
Given the same branch condition in `a` and `c` SimplifyCFG converts:

        +> b -+
        |     v
    --> a --> c --> e -->
              |     ^
              +> d -+
into:

        +--> bcd ---+
        |           v
    --> a --> c --> e -->

Remap source atoms on instructions duplicated from `c` into `bcd`.

RFC:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
2025-05-07 09:56:30 +01:00
Orlando Cazalet-Hyams
a363ccaf18
[KeyInstr][debugify] Add --debugify-atoms to add key instructions metadata (#133483)
RFC:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
2025-05-06 16:15:26 +01:00
Orlando Cazalet-Hyams
f8de1618cc
[KeyInstr][SimplifyCFG] Remap atoms when folding br to common succ into pred (#133482)
SimplifyCFG folds `d` into preds `b` and `c`.

              +---------------+
              |               |
         +--> b --+           |
         |        v           v
     --> a        d --> e --> f -->
         |        ^           ^
         +--> c --+           |
              |               |
              +---------------+
    
Remap source atoms so that the duplicated instructions are analysed
independently to determine is_stmt positions.

The pull request contains a discussion covering various edge cases here:
https://github.com/llvm/llvm-project/pull/133482/files#r2039519348

The summary of the discussion is that we could avoid remapping when there's a
single pred, but we decided that it's still a trade off, and not worth the
additional complexity right now.

RFC:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
2025-05-06 15:03:20 +01:00
Orlando Cazalet-Hyams
73a7a3dc00
[KeyInstr] Inline atom info (#133481)
Source atom groups are identified by an atom group number and inlined-at pair,
so we simply can copy the atom numbers into the caller when inlining.

RFC:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
2025-05-06 14:38:41 +01:00
Orlando Cazalet-Hyams
0c7c82af23
[KeyInstr] Add fields to DILocation behind compile time flag (#133477)
Add AtomGroup and AtomRank to DILocation behind compile time flag
EXPERIMENTAL_KEY_INSTRUCTIONS which is controlled by cmake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONS.

Add IR read-write roundtrip test in a directory that is unsupported unless the
CMake flag is enabled.

RFC: https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
2025-05-01 15:40:39 +01:00