[llvm] Insert symbols for prefetch targets read from basic blocks section profile. (PR #168439)

Rahman Lavaee via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 17 16:11:54 PST 2025


================
@@ -42,6 +42,16 @@ struct BBClusterInfo {
   unsigned PositionInCluster;
 };
 
+// Assuming a block is split into subblocks across its callsites, this struct
+// uniquely identifies the subblock in block `BBID` which starts from right
+// after call number `SubblockIndex` (or the beginning of the block if
+// `SubblockIndex` is zero) to the call number `SubblockIndex+1` (or the end of
+// the block if `SubblockIndex` is the last call in the block).
+struct SubblockID {
+  UniqueBBID BBID;
+  unsigned SubblockIndex;
----------------
rlavaee wrote:

Prefetch targets and instructions are only placed at the beginning of a subblock (either the beginning of the block , or *after* calls). So we don't need the negativity. 

> we can define two 'pseudo calls' one at the beginning of a block and one at the end, so the first real call always get id == 1.

No need for a pseudo call at the end, but with one at the beginning, we get subBlockIndex+1. I can change it back to `int callsiteIndex` and have callsiteIndex == -1 refer to the prefetch target being mapped to the beginning of the block.  WDYT about this?

https://github.com/llvm/llvm-project/pull/168439


More information about the llvm-commits mailing list