forked from OSchip/llvm-project
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. llvm-svn: 252763
This commit is contained in:
parent
0f40ea5dfe
commit
0354a9f67b
|
@ -98,8 +98,8 @@ FunctionPass *llvm::createAddDiscriminatorsPass() {
|
|||
}
|
||||
|
||||
static bool hasDebugInfo(const Function &F) {
|
||||
NamedMDNode *CUNodes = F.getParent()->getNamedMetadata("llvm.dbg.cu");
|
||||
return CUNodes != nullptr;
|
||||
DISubprogram *S = getDISubprogram(&F);
|
||||
return S != nullptr;
|
||||
}
|
||||
|
||||
/// \brief Assign DWARF discriminators.
|
||||
|
|
|
@ -37,7 +37,11 @@ if.end: ; preds = %if.then, %entry
|
|||
|
||||
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" }
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
; We should be able to add discriminators even in the absence of llvm.dbg.cu.
|
||||
; When using sample profiles, the front end will generate line tables but it
|
||||
; does not generate llvm.dbg.cu to prevent codegen from emitting debug info
|
||||
; to the final binary.
|
||||
; !llvm.dbg.cu = !{!0}
|
||||
!llvm.module.flags = !{!7, !8}
|
||||
!llvm.ident = !{!9}
|
||||
|
||||
|
|
|
@ -23,7 +23,11 @@ declare void @_Z3barv() #1
|
|||
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" }
|
||||
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" }
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
; We should be able to add discriminators even in the absence of llvm.dbg.cu.
|
||||
; When using sample profiles, the front end will generate line tables but it
|
||||
; does not generate llvm.dbg.cu to prevent codegen from emitting debug info
|
||||
; to the final binary.
|
||||
; !llvm.dbg.cu = !{!0}
|
||||
!llvm.module.flags = !{!7, !8}
|
||||
!llvm.ident = !{!9}
|
||||
|
||||
|
|
|
@ -46,7 +46,11 @@ if.end: ; preds = %if.then, %entry
|
|||
|
||||
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" }
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
; We should be able to add discriminators even in the absence of llvm.dbg.cu.
|
||||
; When using sample profiles, the front end will generate line tables but it
|
||||
; does not generate llvm.dbg.cu to prevent codegen from emitting debug info
|
||||
; to the final binary.
|
||||
; !llvm.dbg.cu = !{!0}
|
||||
!llvm.module.flags = !{!7, !8}
|
||||
!llvm.ident = !{!9}
|
||||
|
||||
|
|
|
@ -47,7 +47,11 @@ if.end: ; preds = %if.else, %if.then
|
|||
|
||||
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" }
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
; We should be able to add discriminators even in the absence of llvm.dbg.cu.
|
||||
; When using sample profiles, the front end will generate line tables but it
|
||||
; does not generate llvm.dbg.cu to prevent codegen from emitting debug info
|
||||
; to the final binary.
|
||||
; !llvm.dbg.cu = !{!0}
|
||||
!llvm.module.flags = !{!7, !8}
|
||||
!llvm.ident = !{!9}
|
||||
|
||||
|
|
|
@ -44,6 +44,10 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
|
|||
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" }
|
||||
attributes #1 = { nounwind readnone }
|
||||
|
||||
; We should be able to add discriminators even in the absence of llvm.dbg.cu.
|
||||
; When using sample profiles, the front end will generate line tables but it
|
||||
; does not generate llvm.dbg.cu to prevent codegen from emitting debug info
|
||||
; to the final binary.
|
||||
!llvm.dbg.cu = !{!0}
|
||||
!llvm.module.flags = !{!10, !11}
|
||||
!llvm.ident = !{!12}
|
||||
|
|
|
@ -54,7 +54,11 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
|
|||
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" }
|
||||
attributes #1 = { nounwind readnone }
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
; We should be able to add discriminators even in the absence of llvm.dbg.cu.
|
||||
; When using sample profiles, the front end will generate line tables but it
|
||||
; does not generate llvm.dbg.cu to prevent codegen from emitting debug info
|
||||
; to the final binary.
|
||||
; !llvm.dbg.cu = !{!0}
|
||||
!llvm.module.flags = !{!10, !11}
|
||||
!llvm.ident = !{!12}
|
||||
|
||||
|
|
Loading…
Reference in New Issue