532342 Commits

Author SHA1 Message Date
Orlando Cazalet-Hyams
c7f302e62c [NFC][KeyInstr][Clang] Add some additional tests
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943

new.cpp: Check store of addr and value are both added to same atom
cast.c: Check we look through casts
multi-func.c Check the atom group number is reset between functions
2025-04-07 14:17:39 +01:00
Orlando Cazalet-Hyams
e5779b993f [KeyInstr][Clang] Coerce through memory atom 2025-04-07 14:17:39 +01:00
Orlando Cazalet-Hyams
51bedf4b28 [KeyInstr][Clang] Coerce packed struct atom 2025-04-07 14:17:38 +01:00
Orlando Cazalet-Hyams
cbc0ee6bde [KeyInstr][Clang] Coerced ptr to int atom 2025-04-07 14:17:38 +01:00
Orlando Cazalet-Hyams
195697274e [KeyInstr][Clang] Coerced to int atom 2025-04-07 14:17:38 +01:00
Orlando Cazalet-Hyams
a33199f7fb [KeyInstr][Clang] Coerced store atoms
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:38 +01:00
Orlando Cazalet-Hyams
e5b6141602 [KeyInstr][Clang] Update tests with ret atoms 2025-04-07 14:17:37 +01:00
Orlando Cazalet-Hyams
10f161b963 [KeyInstr][Clang] Ret atom
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:37 +01:00
Orlando Cazalet-Hyams
5408901bc6 [KeyInstr][Clang] Store-like builtin atoms 2025-04-07 14:17:37 +01:00
Orlando Cazalet-Hyams
6741ef34bd [KeyInstr][Clang] matrix store atom 2025-04-07 14:17:37 +01:00
Orlando Cazalet-Hyams
94dc187b03 [KeyIntsr][Clang] Builtins alloca auto-init atom
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:36 +01:00
Orlando Cazalet-Hyams
eb19277803 [KeyInstr][Clang] Assign matrix element atom
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:36 +01:00
Orlando Cazalet-Hyams
85936471fc [KeyInstr][Clang] Assign vector element atom
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:36 +01:00
Orlando Cazalet-Hyams
1c670c04c0 [KeyInstr][Clang] Bitfield atom
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:36 +01:00
Orlando Cazalet-Hyams
2484a49c8f [KeyInstr][Clang] For range stmt atoms
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:35 +01:00
Orlando Cazalet-Hyams
375ca9f7b7 [KeyInstr][Clang] For stmt atom
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:35 +01:00
Orlando Cazalet-Hyams
38f3eec43e [KeyInstr][Clang] While stmt atom
See test comment for possible future improvement.

This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:35 +01:00
Orlando Cazalet-Hyams
2ee4d451f7 [KeyInstr][Clang] Do stmt atom
See test comment for possible future improvement.

This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:35 +01:00
Orlando Cazalet-Hyams
eeee08d6d9 [KeyInstr][Clang] Switch stmt atom
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:34 +01:00
Orlando Cazalet-Hyams
98ea64f7a1 [KeyInstr][Clang] If stmt atom
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:34 +01:00
Orlando Cazalet-Hyams
638b319d13 [KeyInstr][Clang] Catch variable init atom
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:34 +01:00
Orlando Cazalet-Hyams
c25359bdeb [KeyInstr][Clang] Member initalization atom
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:34 +01:00
Orlando Cazalet-Hyams
77f91f53a7 [KeyInstr][Clang] Agg copy atom 2025-04-07 14:17:33 +01:00
Orlando Cazalet-Hyams
c1ec75f22a [KeyInstr][Clang] Aggregate init + copy
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:33 +01:00
Orlando Cazalet-Hyams
8ce070ebdd [KeyInstr] Complex assignment atoms
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:33 +01:00
Orlando Cazalet-Hyams
678876993d Rename test & run C & C++ 2025-04-07 14:17:33 +01:00
Orlando Cazalet-Hyams
800fde97f2 Pre/Post Inc/Dec 2025-04-07 14:17:32 +01:00
Orlando Cazalet-Hyams
e92a5d1b0f Compound assign 2025-04-07 14:17:32 +01:00
Orlando Cazalet-Hyams
b6f42ab8be [KeyInstr][Clang] Multiple assignment (x = y = z) 2025-04-07 14:17:32 +01:00
Orlando Cazalet-Hyams
cdf3eef4a2 [KeyInstr][Clang] Assignment atom group
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:31 +01:00
Orlando Cazalet-Hyams
a92afbf589 [KeyInstr][Clang] Static variable init atom
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:31 +01:00
Orlando Cazalet-Hyams
eef73d31b6 [KeyInstr][Clang] Init pattern atom 2025-04-07 14:17:31 +01:00
Orlando Cazalet-Hyams
3eae9188c3 [KeyInstr] init-agg pattern 2025-04-07 14:17:31 +01:00
Orlando Cazalet-Hyams
1f1f1d5d88 shouldUseBZeroPlusStoresToInitialize 2025-04-07 14:17:30 +01:00
Orlando Cazalet-Hyams
06b9688ecb [KeyInstr][Clang] Agg init atom
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:30 +01:00
Orlando Cazalet-Hyams
a644c795b1 [Clang][NFC] Move some static functions into CodeGenFunction
The next patch in the stack needs to access CGF in these functions. 2
CGF fields are passed to these functions already; at this point it
felt natural to promote them to CGF methods.
2025-04-07 14:17:30 +01:00
Orlando Cazalet-Hyams
29d5428307 [KeyInstr][Clang] Scalar init atom
This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:30 +01:00
Orlando Cazalet-Hyams
856f99ea6b [KeyInstr][Clang] Add ApplyAtomGroup
This is a scoped helper similar to ApplyDebugLocation that creates a new source
atom group which instructions can be added to.

A source atom is a source construct that is "interesting" for debug stepping
purposes. We use an atom group number to track the instruction(s) that implement
the functionality for the atom, plus backup instructions/source locations.

---

This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:29 +01:00
Orlando Cazalet-Hyams
7132dd30a1 [KeyInstr][Clang] Add Clang option -g[no-]key-instructions
This needs to be driver level to pass an -mllvm flag to LLVM.

Keep the flag help-hidden as the feature is under development.

---

This patch is part of a stack that teaches Clang to generate Key Instructions
metadata for C and C++.

The Key Instructions project is introduced, including a "quick summary" section
at the top which adds context for this PR, here:
https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668

The feature is only functional in LLVM if LLVM is built with CMake flag
LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.

The Clang-side work is demoed here:
https://github.com/llvm/llvm-project/pull/130943
2025-04-07 14:17:29 +01:00
Orlando Cazalet-Hyams
0b206ae056 [KeyInstr][DwarfDebug] Add is_stmt emission support
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.
2025-03-28 17:07:05 +00:00
Orlando Cazalet-Hyams
b49eb510a9 [KeyInstr] Add MIR parser support 2025-03-28 17:07:05 +00:00
Orlando Cazalet-Hyams
7926adb4d3 [KeyInstr] Remap cloned PHIs in BreakCriticalEdges 2025-03-28 17:07:05 +00:00
Orlando Cazalet-Hyams
4e4a75dd53 Propagate DebugLocs on phis in BreakCriticalEdges 2025-03-28 17:07:05 +00:00
Orlando Cazalet-Hyams
1f03a5db32 [KeyInstr][LoopUnswitch] Remap cloned instructions' atoms 2025-03-28 17:07:04 +00:00
Orlando Cazalet-Hyams
20a853373f [KeyInstr][LoopRotate] Remap atoms of duplicated instructions 2025-03-28 17:07:04 +00:00
Orlando Cazalet-Hyams
fc36dec27c [KeyInstr][LoopUnroll] Remap atoms while unrolling 2025-03-28 17:07:04 +00:00
Orlando Cazalet-Hyams
6488f4bca6 [KeyInstr][JumpThreading] Remap atoms duping bb with cond br on phi into pred
See test for details.
2025-03-28 17:07:04 +00:00
Orlando Cazalet-Hyams
272f806606 [KeyInstr][JumpThreading] Remap atoms after threading 2025-03-28 17:07:04 +00:00
Orlando Cazalet-Hyams
3cc84e5c3d [KeyInstr][JumpThreading] Remap atoms in blocks duplicated for threading 2025-03-28 17:07:04 +00:00
Orlando Cazalet-Hyams
637b5b4ae3 [KeyInstr][Inline] Don't propagate atoms to inlined nodebug instructions 2025-03-28 17:07:04 +00:00