1- ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2-
31;; Test to ensure that memprof related metadata is not dropped when
42;; instructions are combined. Currently the metadata from the first instruction
53;; is kept, which prevents full loss of profile context information.
@@ -32,6 +30,51 @@ if.end: ; preds = %if.else, %if.then
3230 ret ptr %x.0
3331}
3432
33+ define dso_local noundef nonnull ptr @_Z9test_leftb (i1 noundef zeroext %b ) local_unnamed_addr #0 {
34+ ; CHECK-LABEL: define dso_local noundef nonnull ptr @_Z9test_leftb(
35+ ; CHECK-SAME: i1 noundef zeroext [[B:%.*]]) local_unnamed_addr {
36+ ; CHECK-NEXT: [[ENTRY:.*:]]
37+ ; CHECK-NEXT: [[CALL:%.*]] = call noalias noundef nonnull dereferenceable(4) ptr @_Znwm(i64 noundef 4), !memprof [[META0:![0-9]+]], !callsite [[META3:![0-9]+]]
38+ ; CHECK-NEXT: ret ptr [[CALL]]
39+ ;
40+ entry:
41+ br i1 %b , label %if.then , label %if.else
42+
43+ if.then: ; preds = %entry
44+ %call = call noalias noundef nonnull dereferenceable (4 ) ptr @_Znwm (i64 noundef 4 ), !memprof !0 , !callsite !3
45+ br label %if.end
46+
47+ if.else: ; preds = %entry
48+ %call1 = call noalias noundef nonnull dereferenceable (4 ) ptr @_Znwm (i64 noundef 4 )
49+ br label %if.end
50+
51+ if.end: ; preds = %if.else, %if.then
52+ %x.0 = phi ptr [ %call , %if.then ], [ %call1 , %if.else ]
53+ ret ptr %x.0
54+ }
55+
56+ define dso_local noundef nonnull ptr @_Z10test_rightb (i1 noundef zeroext %b ) local_unnamed_addr #0 {
57+ ; CHECK-LABEL: define dso_local noundef nonnull ptr @_Z10test_rightb(
58+ ; CHECK-SAME: i1 noundef zeroext [[B:%.*]]) local_unnamed_addr {
59+ ; CHECK-NEXT: [[ENTRY:.*:]]
60+ ; CHECK-NEXT: [[CALL:%.*]] = call noalias noundef nonnull dereferenceable(4) ptr @_Znwm(i64 noundef 4), !memprof [[META4:![0-9]+]], !callsite [[META7:![0-9]+]]
61+ ; CHECK-NEXT: ret ptr [[CALL]]
62+ ;
63+ entry:
64+ br i1 %b , label %if.then , label %if.else
65+
66+ if.then: ; preds = %entry
67+ %call = call noalias noundef nonnull dereferenceable (4 ) ptr @_Znwm (i64 noundef 4 )
68+ br label %if.end
69+
70+ if.else: ; preds = %entry
71+ %call1 = call noalias noundef nonnull dereferenceable (4 ) ptr @_Znwm (i64 noundef 4 ), !memprof !4 , !callsite !7
72+ br label %if.end
73+
74+ if.end: ; preds = %if.else, %if.then
75+ %x.0 = phi ptr [ %call , %if.then ], [ %call1 , %if.else ]
76+ ret ptr %x.0
77+ }
3578
3679declare ptr @_Znwm (i64 ) nounwind readonly
3780
@@ -43,9 +86,13 @@ declare ptr @_Znwm(i64) nounwind readonly
4386!5 = !{!6 , !"cold" }
4487!6 = !{i64 123 , i64 -2101080423462424381 , i64 5188446645037944434 }
4588!7 = !{i64 123 }
46- ;.
89+
4790; CHECK: [[META0]] = !{[[META1:![0-9]+]]}
4891; CHECK: [[META1]] = !{[[META2:![0-9]+]], !"notcold"}
4992; CHECK: [[META2]] = !{i64 -852997907418798798, i64 -2101080423462424381, i64 5188446645037944434}
5093; CHECK: [[META3]] = !{i64 -852997907418798798}
51- ;.
94+ ; CHECK: [[META4]] = !{[[META5:![0-9]+]]}
95+ ; CHECK: [[META5]] = !{[[META6:![0-9]+]], !"cold"}
96+ ; CHECK: [[META6]] = !{i64 123, i64 -2101080423462424381, i64 5188446645037944434}
97+ ; CHECK: [[META7]] = !{i64 123}
98+
0 commit comments