478 lines · plain
1;; Test that correct clones are generated and reached when we need to2;; re-merge clone nodes before function assignment.3;;4;; The code is similar to that of mergenodes.ll, but with two additional5;; contexts sharing the same two allocations. This tests that we correctly6;; share the merged nodes when possible.7 8; RUN: opt -passes=memprof-context-disambiguation -supports-hot-cold-new \9;; Disable merge iteration for now as it causes spurious diffs due to different10;; iteration order (but the same ultimate hinting of the contexts).11; RUN: -memprof-merge-iteration=false \12; RUN: -memprof-verify-ccg -memprof-dump-ccg %s -S 2>&1 | FileCheck %s \13; RUN: --check-prefix=IR --check-prefix=DUMP14 15target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"16target triple = "x86_64-unknown-linux-gnu"17 18define i32 @main() {19entry:20 ;; Ultimately calls bar and allocates notcold memory from first call to new21 ;; and cold memory from second call to new.22 %call = call noundef ptr @_Z3foov(), !callsite !023 ;; Ultimately calls bar and allocates cold memory from first call to new24 ;; and notcold memory from second call to new.25 %call1 = call noundef ptr @_Z3foov(), !callsite !126 ;; Same allocation pattern as the first call to foo above, should end up27 ;; sharing the same merge nodes.28 %call2 = call noundef ptr @_Z3foov(), !callsite !1929 ;; Same allocation pattern as the second call to foo above, should end up30 ;; sharing the same merge nodes.31 %call3 = call noundef ptr @_Z3foov(), !callsite !2032 ret i32 033}34 35define internal ptr @_Z3barv() {36entry:37 ;; notcold when called from first and third calls to foo from main, cold when38 ;; called from second and fourth.39 %call = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #0, !memprof !2, !callsite !740 ;; cold when called from first and third calls to foo from main, notcold when41 ;; called from second and fourth.42 %call2 = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #0, !memprof !13, !callsite !1843 ret ptr null44}45 46declare ptr @_Znam(i64)47 48define internal ptr @_Z3bazv() {49entry:50 %call = call noundef ptr @_Z3barv(), !callsite !851 ret ptr null52}53 54; Function Attrs: noinline55define internal ptr @_Z3foov() {56entry:57 %call = call noundef ptr @_Z3bazv(), !callsite !958 ret ptr null59}60 61attributes #0 = { builtin }62 63!0 = !{i64 8632435727821051414}64!1 = !{i64 -3421689549917153178}65!19 = !{i64 8910}66!20 = !{i64 91011}67!2 = !{!3, !5, !21, !23}68!3 = !{!4, !"notcold"}69!4 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 8632435727821051414}70!5 = !{!6, !"cold"}71!6 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 -3421689549917153178}72!21 = !{!22, !"notcold"}73!22 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 8910}74!23 = !{!24, !"cold"}75!24 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 91011}76!7 = !{i64 9086428284934609951}77!8 = !{i64 -5964873800580613432}78!9 = !{i64 2732490490862098848}79!13 = !{!14, !16, !25, !27}80!14 = !{!15, !"cold"}81!15 = !{i64 123, i64 -5964873800580613432, i64 2732490490862098848, i64 8632435727821051414}82!16 = !{!17, !"notcold"}83!17 = !{i64 123, i64 -5964873800580613432, i64 2732490490862098848, i64 -3421689549917153178}84!25 = !{!26, !"cold"}85!26 = !{i64 123, i64 -5964873800580613432, i64 2732490490862098848, i64 8910}86!27 = !{!28, !"notcold"}87!28 = !{i64 123, i64 -5964873800580613432, i64 2732490490862098848, i64 91011}88!18 = !{i64 123}89 90;; After cloning, each callsite in main calls different clones of foo with91;; different allocaton types, and ditto all the way through the leaf92;; allocation callsites. The single allocation-type clones are shared between93;; the four callsites in main. This would lead to incorrect assignment of94;; the leaf allocations to function clones as is, since we have lost the95;; information that each callsite in main ultimately reaches two allocation96;; callsites with *different* allocation types.97; DUMP: CCG after cloning:98; DUMP: Callsite Context Graph:99; DUMP: Node [[BAR1ALLOC1:0x[a-f0-9]+]]100; DUMP: %call = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #0 (clone 0)101; DUMP: AllocTypes: NotCold102; DUMP: ContextIds: 1 3103; DUMP: CalleeEdges:104; DUMP: CallerEdges:105; DUMP: Edge from Callee [[BAR1ALLOC1]] to Caller: [[BAZ1:0x[a-f0-9]+]] AllocTypes: NotCold ContextIds: 1 3106; DUMP: Clones: [[BAR2ALLOC1:0x[a-f0-9]+]]107 108; DUMP: Node [[BAZ1]]109; DUMP: %call = call noundef ptr @_Z3barv() (clone 0)110; DUMP: AllocTypes: NotCold111; DUMP: ContextIds: 1 3 6 8112; DUMP: CalleeEdges:113; DUMP: Edge from Callee [[BAR1ALLOC1]] to Caller: [[BAZ1]] AllocTypes: NotCold ContextIds: 1 3114; DUMP: Edge from Callee [[BAR1ALLOC2:0x[a-f0-9]+]] to Caller: [[BAZ1]] AllocTypes: NotCold ContextIds: 6 8115; DUMP: CallerEdges:116; DUMP: Edge from Callee [[BAZ1]] to Caller: [[FOO1:0x[a-f0-9]+]] AllocTypes: NotCold ContextIds: 1 3 6 8117; DUMP: Clones: [[BAZ2:0x[a-f0-9]+]]118 119; DUMP: Node [[FOO1]]120; DUMP: %call = call noundef ptr @_Z3bazv() (clone 0)121; DUMP: AllocTypes: NotCold122; DUMP: ContextIds: 1 3 6 8123; DUMP: CalleeEdges:124; DUMP: Edge from Callee [[BAZ1]] to Caller: [[FOO1]] AllocTypes: NotCold ContextIds: 1 3 6 8125; DUMP: CallerEdges:126; DUMP: Edge from Callee [[FOO1]] to Caller: [[MAIN1:0x[a-f0-9]+]] AllocTypes: NotCold ContextIds: 1127; DUMP: Edge from Callee [[FOO1]] to Caller: [[MAIN3:0x[a-f0-9]+]] AllocTypes: NotCold ContextIds: 3128; DUMP: Edge from Callee [[FOO1]] to Caller: [[MAIN2:0x[a-f0-9]+]] AllocTypes: NotCold ContextIds: 6129; DUMP: Edge from Callee [[FOO1]] to Caller: [[MAIN4:0x[a-f0-9]+]] AllocTypes: NotCold ContextIds: 8130; DUMP: Clones: [[FOO2:0x[a-f0-9]+]]131 132; DUMP: Node [[MAIN1]]133; DUMP: %call = call noundef ptr @_Z3foov() (clone 0)134; DUMP: AllocTypes: NotColdCold135; DUMP: ContextIds: 1 5136; DUMP: CalleeEdges:137; DUMP: Edge from Callee [[FOO1]] to Caller: [[MAIN1]] AllocTypes: NotCold ContextIds: 1138; DUMP: Edge from Callee [[FOO2:0x[a-f0-9]+]] to Caller: [[MAIN1]] AllocTypes: Cold ContextIds: 5139; DUMP: CallerEdges:140 141; DUMP: Node [[MAIN2]]142; DUMP: %call1 = call noundef ptr @_Z3foov() (clone 0)143; DUMP: AllocTypes: NotColdCold144; DUMP: ContextIds: 2 6145; DUMP: CalleeEdges:146; DUMP: Edge from Callee [[FOO1]] to Caller: [[MAIN2]] AllocTypes: NotCold ContextIds: 6147; DUMP: Edge from Callee [[FOO2]] to Caller: [[MAIN2]] AllocTypes: Cold ContextIds: 2148; DUMP: CallerEdges:149 150; DUMP: Node [[MAIN3]]151; DUMP: %call2 = call noundef ptr @_Z3foov() (clone 0)152; DUMP: AllocTypes: NotColdCold153; DUMP: ContextIds: 3 7154; DUMP: CalleeEdges:155; DUMP: Edge from Callee [[FOO1]] to Caller: [[MAIN3]] AllocTypes: NotCold ContextIds: 3156; DUMP: Edge from Callee [[FOO2]] to Caller: [[MAIN3]] AllocTypes: Cold ContextIds: 7157; DUMP: CallerEdges:158 159; DUMP: Node [[MAIN4]]160; DUMP: %call3 = call noundef ptr @_Z3foov() (clone 0)161; DUMP: AllocTypes: NotColdCold162; DUMP: ContextIds: 4 8163; DUMP: CalleeEdges:164; DUMP: Edge from Callee [[FOO1]] to Caller: [[MAIN4]] AllocTypes: NotCold ContextIds: 8165; DUMP: Edge from Callee [[FOO2]] to Caller: [[MAIN4]] AllocTypes: Cold ContextIds: 4166; DUMP: CallerEdges:167 168; DUMP: Node [[BAR1ALLOC2]]169; DUMP: %call2 = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #0 (clone 0)170; DUMP: AllocTypes: NotCold171; DUMP: ContextIds: 6 8172; DUMP: CalleeEdges:173; DUMP: CallerEdges:174; DUMP: Edge from Callee [[BAR1ALLOC2]] to Caller: [[BAZ1]] AllocTypes: NotCold ContextIds: 6 8175; DUMP: Clones: [[BAR2ALLOC2:0x[a-f0-9]+]]176 177; DUMP: Node [[FOO2]]178; DUMP: %call = call noundef ptr @_Z3bazv() (clone 0)179; DUMP: AllocTypes: Cold180; DUMP: ContextIds: 2 4 5 7181; DUMP: CalleeEdges:182; DUMP: Edge from Callee [[BAZ2]] to Caller: [[FOO2]] AllocTypes: Cold ContextIds: 2 4 5 7183; DUMP: CallerEdges:184; DUMP: Edge from Callee [[FOO2]] to Caller: [[MAIN2]] AllocTypes: Cold ContextIds: 2185; DUMP: Edge from Callee [[FOO2]] to Caller: [[MAIN4]] AllocTypes: Cold ContextIds: 4186; DUMP: Edge from Callee [[FOO2]] to Caller: [[MAIN1]] AllocTypes: Cold ContextIds: 5187; DUMP: Edge from Callee [[FOO2]] to Caller: [[MAIN3]] AllocTypes: Cold ContextIds: 7188; DUMP: Clone of [[FOO1]]189 190; DUMP: Node [[BAZ2]]191; DUMP: %call = call noundef ptr @_Z3barv() (clone 0)192; DUMP: AllocTypes: Cold193; DUMP: ContextIds: 2 4 5 7194; DUMP: CalleeEdges:195; DUMP: Edge from Callee [[BAR2ALLOC1]] to Caller: [[BAZ2]] AllocTypes: Cold ContextIds: 2 4196; DUMP: Edge from Callee [[BAR2ALLOC2]] to Caller: [[BAZ2]] AllocTypes: Cold ContextIds: 5 7197; DUMP: CallerEdges:198; DUMP: Edge from Callee [[BAZ2]] to Caller: [[FOO2]] AllocTypes: Cold ContextIds: 2 4 5 7199; DUMP: Clone of [[BAZ1]]200 201; DUMP: Node [[BAR2ALLOC1]]202; DUMP: %call = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #0 (clone 0)203; DUMP: AllocTypes: Cold204; DUMP: ContextIds: 2 4205; DUMP: CalleeEdges:206; DUMP: CallerEdges:207; DUMP: Edge from Callee [[BAR2ALLOC1]] to Caller: [[BAZ2]] AllocTypes: Cold ContextIds: 2 4208; DUMP: Clone of [[BAR1ALLOC1]]209 210; DUMP: Node [[BAR2ALLOC2]]211; DUMP: %call2 = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #0 (clone 0)212; DUMP: AllocTypes: Cold213; DUMP: ContextIds: 5 7214; DUMP: CalleeEdges:215; DUMP: CallerEdges:216; DUMP: Edge from Callee [[BAR2ALLOC2]] to Caller: [[BAZ2]] AllocTypes: Cold ContextIds: 5 7217; DUMP: Clone of [[BAR1ALLOC2]]218 219;; After merging, each pair of callsites in main with the same allocation220;; pattern call a different single clone of foo with both cold and not cold221;; allocation types, but ultimately reach two single allocation type222;; allocation callsite clones of the correct combination. The graph after223;; assigning function clones is the same, but with function calls updated to224;; the new function clones.225; DUMP: CCG after merging:226; DUMP: Callsite Context Graph:227; DUMP: Node [[BAR1ALLOC1]]228; DUMP: %call = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #0 (clone 0)229; DUMP: AllocTypes: NotCold230; DUMP: ContextIds: 1 3231; DUMP: CalleeEdges:232; DUMP: CallerEdges:233; DUMP: Edge from Callee [[BAR1ALLOC1]] to Caller: [[BAZ2]] AllocTypes: NotCold ContextIds: 1 3234; DUMP: Clones: [[BAR2ALLOC1]]235 236; DUMP: Node [[MAIN1]]237; DUMP: %call = call noundef ptr @_Z3foov() (clone 0)238; DUMP: AllocTypes: NotColdCold239; DUMP: ContextIds: 1 5240; DUMP: CalleeEdges:241; DUMP: Edge from Callee [[FOO3:0x[a-f0-9]+]] to Caller: [[MAIN1]] AllocTypes: NotColdCold ContextIds: 1 5242; DUMP: CallerEdges:243 244; DUMP: Node [[MAIN2]]245; DUMP: %call1 = call noundef ptr @_Z3foov() (clone 0)246; DUMP: AllocTypes: NotColdCold247; DUMP: ContextIds: 2 6248; DUMP: CalleeEdges:249; DUMP: Edge from Callee [[FOO2]] to Caller: [[MAIN2]] AllocTypes: NotColdCold ContextIds: 2 6250; DUMP: CallerEdges:251 252; DUMP: Node [[MAIN3]]253; DUMP: %call2 = call noundef ptr @_Z3foov() (clone 0)254; DUMP: AllocTypes: NotColdCold255; DUMP: ContextIds: 3 7256; DUMP: CalleeEdges:257; DUMP: Edge from Callee [[FOO3]] to Caller: [[MAIN3]] AllocTypes: NotColdCold ContextIds: 3 7258; DUMP: CallerEdges:259 260; DUMP: Node [[MAIN4]]261; DUMP: %call3 = call noundef ptr @_Z3foov() (clone 0)262; DUMP: AllocTypes: NotColdCold263; DUMP: ContextIds: 4 8264; DUMP: CalleeEdges:265; DUMP: Edge from Callee [[FOO2]] to Caller: [[MAIN4]] AllocTypes: NotColdCold ContextIds: 4 8266; DUMP: CallerEdges:267 268; DUMP: Node [[BAR1ALLOC2]]269; DUMP: %call2 = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #0 (clone 0)270; DUMP: AllocTypes: NotCold271; DUMP: ContextIds: 6 8272; DUMP: CalleeEdges:273; DUMP: CallerEdges:274; DUMP: Edge from Callee [[BAR1ALLOC2]] to Caller: [[BAZ3:0x[a-f0-9]+]] AllocTypes: NotCold ContextIds: 6 8275; DUMP: Clones: [[BAR2ALLOC2]]276 277; DUMP: Node [[FOO2]]278; DUMP: %call = call noundef ptr @_Z3bazv() (clone 0)279; DUMP: AllocTypes: NotColdCold280; DUMP: ContextIds: 2 4 6 8281; DUMP: CalleeEdges:282; DUMP: Edge from Callee [[BAZ3]] to Caller: [[FOO2]] AllocTypes: NotColdCold ContextIds: 2 4283; DUMP: CallerEdges:284; DUMP: Edge from Callee [[FOO2]] to Caller: [[MAIN2]] AllocTypes: NotColdCold ContextIds: 2 6285; DUMP: Edge from Callee [[FOO2]] to Caller: [[MAIN4]] AllocTypes: NotColdCold ContextIds: 4 8286; DUMP: Clone of [[FOO1]]287 288; DUMP: Node [[BAZ2]]289; DUMP: %call = call noundef ptr @_Z3barv() (clone 0)290; DUMP: AllocTypes: NotColdCold291; DUMP: ContextIds: 1 3 5 7292; DUMP: CalleeEdges:293; DUMP: Edge from Callee [[BAR2ALLOC2]] to Caller: [[BAZ2]] AllocTypes: Cold ContextIds: 5 7294; DUMP: Edge from Callee [[BAR1ALLOC1]] to Caller: [[BAZ2]] AllocTypes: NotCold ContextIds: 1 3295; DUMP: CallerEdges:296; DUMP: Edge from Callee [[BAZ2]] to Caller: [[FOO3]] AllocTypes: NotColdCold ContextIds: 1 3 5 7297; DUMP: Clone of [[BAZ1]]298 299; DUMP: Node [[BAR2ALLOC1]]300; DUMP: %call = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #0 (clone 0)301; DUMP: AllocTypes: Cold302; DUMP: ContextIds: 2 4303; DUMP: CalleeEdges:304; DUMP: CallerEdges:305; DUMP: Edge from Callee [[BAR2ALLOC1]] to Caller: [[BAZ3]] AllocTypes: Cold ContextIds: 2 4306; DUMP: Clone of [[BAR1ALLOC1]]307 308; DUMP: Node [[BAR2ALLOC2]]309; DUMP: %call2 = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #0 (clone 0)310; DUMP: AllocTypes: Cold311; DUMP: ContextIds: 5 7312; DUMP: CalleeEdges:313; DUMP: CallerEdges:314; DUMP: Edge from Callee [[BAR2ALLOC2]] to Caller: [[BAZ2]] AllocTypes: Cold ContextIds: 5 7315; DUMP: Clone of [[BAR1ALLOC2]]316 317; DUMP: Node [[FOO3]]318; DUMP: %call = call noundef ptr @_Z3bazv() (clone 0)319; DUMP: AllocTypes: NotColdCold320; DUMP: ContextIds: 1 3 5 7321; DUMP: CalleeEdges:322; DUMP: Edge from Callee [[BAZ2]] to Caller: [[FOO3]] AllocTypes: NotColdCold ContextIds: 1 3 5 7323; DUMP: CallerEdges:324; DUMP: Edge from Callee [[FOO3]] to Caller: [[MAIN1]] AllocTypes: NotColdCold ContextIds: 1 5325; DUMP: Edge from Callee [[FOO3]] to Caller: [[MAIN3]] AllocTypes: NotColdCold ContextIds: 3 7326; DUMP: Clone of [[FOO1]]327 328; DUMP: Node [[BAZ3]]329; DUMP: %call = call noundef ptr @_Z3barv() (clone 0)330; DUMP: AllocTypes: NotColdCold331; DUMP: ContextIds: 2 4 6 8332; DUMP: CalleeEdges:333; DUMP: Edge from Callee [[BAR2ALLOC1]] to Caller: [[BAZ3]] AllocTypes: Cold ContextIds: 2 4334; DUMP: Edge from Callee [[BAR1ALLOC2]] to Caller: [[BAZ3]] AllocTypes: NotCold ContextIds: 6 8335; DUMP: CallerEdges:336; DUMP: Edge from Callee [[BAZ3]] to Caller: [[FOO2]] AllocTypes: NotColdCold ContextIds: 2 4 6 8337; DUMP: Clone of [[BAZ1]]338 339; DUMP: CCG after assigning function clones:340; DUMP: Callsite Context Graph:341; DUMP: Node [[BAR1ALLOC1]]342; DUMP: %call = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #0 (clone 0)343; DUMP: AllocTypes: NotCold344; DUMP: ContextIds: 1 3345; DUMP: CalleeEdges:346; DUMP: CallerEdges:347; DUMP: Edge from Callee [[BAR1ALLOC1]] to Caller: [[BAZ2]] AllocTypes: NotCold ContextIds: 1 3348; DUMP: Clones: [[BAR2ALLOC1]]349 350; DUMP: Node [[MAIN1]]351; DUMP: %call = call noundef ptr @_Z3foov.memprof.1() (clone 0)352; DUMP: AllocTypes: NotColdCold353; DUMP: ContextIds: 1 5354; DUMP: CalleeEdges:355; DUMP: Edge from Callee [[FOO3]] to Caller: [[MAIN1]] AllocTypes: NotColdCold ContextIds: 1 5356; DUMP: CallerEdges:357 358; DUMP: Node [[MAIN2]]359; DUMP: %call1 = call noundef ptr @_Z3foov() (clone 0)360; DUMP: AllocTypes: NotColdCold361; DUMP: ContextIds: 2 6362; DUMP: CalleeEdges:363; DUMP: Edge from Callee [[FOO2]] to Caller: [[MAIN2]] AllocTypes: NotColdCold ContextIds: 2 6364; DUMP: CallerEdges:365 366; DUMP: Node [[MAIN3]]367; DUMP: %call2 = call noundef ptr @_Z3foov.memprof.1() (clone 0)368; DUMP: AllocTypes: NotColdCold369; DUMP: ContextIds: 3 7370; DUMP: CalleeEdges:371; DUMP: Edge from Callee [[FOO3]] to Caller: [[MAIN3]] AllocTypes: NotColdCold ContextIds: 3 7372; DUMP: CallerEdges:373 374; DUMP: Node [[MAIN4]]375; DUMP: %call3 = call noundef ptr @_Z3foov() (clone 0)376; DUMP: AllocTypes: NotColdCold377; DUMP: ContextIds: 4 8378; DUMP: CalleeEdges:379; DUMP: Edge from Callee [[FOO2]] to Caller: [[MAIN4]] AllocTypes: NotColdCold ContextIds: 4 8380; DUMP: CallerEdges:381 382; DUMP: Node [[BAR1ALLOC2]]383; DUMP: %call2 = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #1 (clone 1)384; DUMP: AllocTypes: NotCold385; DUMP: ContextIds: 6 8386; DUMP: CalleeEdges:387; DUMP: CallerEdges:388; DUMP: Edge from Callee [[BAR1ALLOC2]] to Caller: [[BAZ3]] AllocTypes: NotCold ContextIds: 6 8389; DUMP: Clones: [[BAR2ALLOC2]]390 391; DUMP: Node [[FOO2]]392; DUMP: %call = call noundef ptr @_Z3bazv.memprof.1() (clone 0)393; DUMP: AllocTypes: NotColdCold394; DUMP: ContextIds: 2 4 6 8395; DUMP: CalleeEdges:396; DUMP: Edge from Callee [[BAZ3]] to Caller: [[FOO2]] AllocTypes: NotColdCold ContextIds: 2 4397; DUMP: CallerEdges:398; DUMP: Edge from Callee [[FOO2]] to Caller: [[MAIN2]] AllocTypes: NotColdCold ContextIds: 2 6399; DUMP: Edge from Callee [[FOO2]] to Caller: [[MAIN4]] AllocTypes: NotColdCold ContextIds: 4 8400; DUMP: Clone of [[FOO1]]401 402; DUMP: Node [[BAZ2]]403; DUMP: %call = call noundef ptr @_Z3barv() (clone 0)404; DUMP: AllocTypes: NotColdCold405; DUMP: ContextIds: 1 3 5 7406; DUMP: CalleeEdges:407; DUMP: Edge from Callee [[BAR2ALLOC2]] to Caller: [[BAZ2]] AllocTypes: Cold ContextIds: 5 7408; DUMP: Edge from Callee [[BAR1ALLOC1]] to Caller: [[BAZ2]] AllocTypes: NotCold ContextIds: 1 3409; DUMP: CallerEdges:410; DUMP: Edge from Callee [[BAZ2]] to Caller: [[FOO3]] AllocTypes: NotColdCold ContextIds: 1 3 5 7411; DUMP: Clone of [[BAZ1]]412 413; DUMP: Node [[BAR2ALLOC1]]414; DUMP: %call = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #0 (clone 1)415; DUMP: AllocTypes: Cold416; DUMP: ContextIds: 2 4417; DUMP: CalleeEdges:418; DUMP: CallerEdges:419; DUMP: Edge from Callee [[BAR2ALLOC1]] to Caller: [[BAZ3]] AllocTypes: Cold ContextIds: 2 4420; DUMP: Clone of [[BAR1ALLOC1]]421 422; DUMP: Node [[BAR2ALLOC2]]423; DUMP: %call2 = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #1 (clone 0)424; DUMP: AllocTypes: Cold425; DUMP: ContextIds: 5 7426; DUMP: CalleeEdges:427; DUMP: CallerEdges:428; DUMP: Edge from Callee [[BAR2ALLOC2]] to Caller: [[BAZ2]] AllocTypes: Cold ContextIds: 5 7429; DUMP: Clone of [[BAR1ALLOC2]]430 431; DUMP: Node [[FOO3]]432; DUMP: %call = call noundef ptr @_Z3bazv() (clone 1)433; DUMP: AllocTypes: NotColdCold434; DUMP: ContextIds: 1 3 5 7435; DUMP: CalleeEdges:436; DUMP: Edge from Callee [[BAZ2]] to Caller: [[FOO3]] AllocTypes: NotColdCold ContextIds: 1 3 5 7437; DUMP: CallerEdges:438; DUMP: Edge from Callee [[FOO3]] to Caller: [[MAIN1]] AllocTypes: NotColdCold ContextIds: 1 5439; DUMP: Edge from Callee [[FOO3]] to Caller: [[MAIN3]] AllocTypes: NotColdCold ContextIds: 3 7440; DUMP: Clone of [[FOO1]]441 442; DUMP: Node [[BAZ3]]443; DUMP: %call = call noundef ptr @_Z3barv.memprof.1() (clone 1)444; DUMP: AllocTypes: NotColdCold445; DUMP: ContextIds: 2 4 6 8446; DUMP: CalleeEdges:447; DUMP: Edge from Callee [[BAR2ALLOC1]] to Caller: [[BAZ3]] AllocTypes: Cold ContextIds: 2 4448; DUMP: Edge from Callee [[BAR1ALLOC2]] to Caller: [[BAZ3]] AllocTypes: NotCold ContextIds: 6 8449; DUMP: CallerEdges:450; DUMP: Edge from Callee [[BAZ3]] to Caller: [[FOO2]] AllocTypes: NotColdCold ContextIds: 2 4 6 8451; DUMP: Clone of [[BAZ1]]452 453; IR: define {{.*}} @main454;; The first call to foo should now call foo.memprof.1 that ultimately455;; calls bar with the first allocation hinted notcold and the second cold456;; (via call chain foo.memprof.1 -> baz -> bar).457; IR: call {{.*}} @_Z3foov.memprof.1()458;; The second call to foo still calls the original foo, but ultimately459;; reaches a clone of bar with the first allocation hinted cold and the460;; second notcold.461; IR: call {{.*}} @_Z3foov()462; IR: define internal {{.*}} @_Z3barv()463; IR: call {{.*}} @_Znam(i64 noundef 10) #[[NOTCOLD:[0-9]+]]464; IR: call {{.*}} @_Znam(i64 noundef 10) #[[COLD:[0-9]+]]465; IR: define internal {{.*}} @_Z3bazv()466; IR: call {{.*}} @_Z3barv()467; IR: define internal {{.*}} @_Z3foov()468; IR: call {{.*}} @_Z3bazv.memprof.1()469; IR: define internal {{.*}} @_Z3barv.memprof.1()470; IR: call {{.*}} @_Znam(i64 noundef 10) #[[COLD]]471; IR: call {{.*}} @_Znam(i64 noundef 10) #[[NOTCOLD]]472; IR: define internal {{.*}} @_Z3bazv.memprof.1()473; IR: call {{.*}} @_Z3barv.memprof.1()474; IR: define internal {{.*}} @_Z3foov.memprof.1()475; IR: call {{.*}} @_Z3bazv()476; IR: attributes #[[NOTCOLD]] = { builtin "memprof"="notcold" }477; IR: attributes #[[COLD]] = { builtin "memprof"="cold" }478