llvm.org GIT mirror llvm / 95b12c8
SamplePGO - Fix PR 25482 - Do not rely on llvm.dbg.cu for discriminators The discriminators pass relied on the presence of llvm.dbg.cu to decide whether to add discriminators, but this fails in the case where debug info is only enabled partially when -fprofile-sample-use is active. The reason llvm.dbg.cu is not present in these cases is to prevent codegen from emitting debug info (as it is only used for the sample profile pass). This changes the discriminators pass to also emit discriminators even when debug info is not being emitted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252763 91177308-0d34-0410-b5e6-96231b3b80d8 Diego Novillo 3 years ago
7 changed file(s) with 31 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
9797 }
9898
9999 static bool hasDebugInfo(const Function &F) {
100 NamedMDNode *CUNodes = F.getParent()->getNamedMetadata("llvm.dbg.cu");
101 return CUNodes != nullptr;
100 DISubprogram *S = getDISubprogram(&F);
101 return S != nullptr;
102102 }
103103
104104 /// \brief Assign DWARF discriminators.
3636
3737 attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
3838
39 !llvm.dbg.cu = !{!0}
39 ; We should be able to add discriminators even in the absence of llvm.dbg.cu.
40 ; When using sample profiles, the front end will generate line tables but it
41 ; does not generate llvm.dbg.cu to prevent codegen from emitting debug info
42 ; to the final binary.
43 ; !llvm.dbg.cu = !{!0}
4044 !llvm.module.flags = !{!7, !8}
4145 !llvm.ident = !{!9}
4246
2222 attributes #0 = { uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
2323 attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
2424
25 !llvm.dbg.cu = !{!0}
25 ; We should be able to add discriminators even in the absence of llvm.dbg.cu.
26 ; When using sample profiles, the front end will generate line tables but it
27 ; does not generate llvm.dbg.cu to prevent codegen from emitting debug info
28 ; to the final binary.
29 ; !llvm.dbg.cu = !{!0}
2630 !llvm.module.flags = !{!7, !8}
2731 !llvm.ident = !{!9}
2832
4545
4646 attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
4747
48 !llvm.dbg.cu = !{!0}
48 ; We should be able to add discriminators even in the absence of llvm.dbg.cu.
49 ; When using sample profiles, the front end will generate line tables but it
50 ; does not generate llvm.dbg.cu to prevent codegen from emitting debug info
51 ; to the final binary.
52 ; !llvm.dbg.cu = !{!0}
4953 !llvm.module.flags = !{!7, !8}
5054 !llvm.ident = !{!9}
5155
4646
4747 attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
4848
49 !llvm.dbg.cu = !{!0}
49 ; We should be able to add discriminators even in the absence of llvm.dbg.cu.
50 ; When using sample profiles, the front end will generate line tables but it
51 ; does not generate llvm.dbg.cu to prevent codegen from emitting debug info
52 ; to the final binary.
53 ; !llvm.dbg.cu = !{!0}
5054 !llvm.module.flags = !{!7, !8}
5155 !llvm.ident = !{!9}
5256
4343 attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
4444 attributes #1 = { nounwind readnone }
4545
46 ; We should be able to add discriminators even in the absence of llvm.dbg.cu.
47 ; When using sample profiles, the front end will generate line tables but it
48 ; does not generate llvm.dbg.cu to prevent codegen from emitting debug info
49 ; to the final binary.
4650 !llvm.dbg.cu = !{!0}
4751 !llvm.module.flags = !{!10, !11}
4852 !llvm.ident = !{!12}
5353 attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
5454 attributes #1 = { nounwind readnone }
5555
56 !llvm.dbg.cu = !{!0}
56 ; We should be able to add discriminators even in the absence of llvm.dbg.cu.
57 ; When using sample profiles, the front end will generate line tables but it
58 ; does not generate llvm.dbg.cu to prevent codegen from emitting debug info
59 ; to the final binary.
60 ; !llvm.dbg.cu = !{!0}
5761 !llvm.module.flags = !{!10, !11}
5862 !llvm.ident = !{!12}
5963