For those loops, promotion counter can lead to loss of profile as there is no place to sync the counter value back to counter memory.
Test case is included in another patch.
Differential D40662
[PGO] Do not do counter promotion for loops without exit blocks ('infinite loops') davidxl on Nov 30 2017, 10:41 AM. Authored by
Details For those loops, promotion counter can lead to loss of profile as there is no place to sync the counter value back to counter memory. Test case is included in another patch.
Diff Detail
Event TimelineComment Actions With an IR-based test case, D40663 shouldn't be necessary -- ; RUN opt -instrprof -S -o - <%s -do-counter-promotion=1 | FileCheck ; CHECK: store target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.12.0" @__profn_foo = private constant [3 x i8] c"foo" define void @foo() { entry: br label %while.body while.body: ; preds = %entry, %while.body call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 14813359968, i32 1, i32 0) call void (...) @bar() #2 br label %while.body } declare void @bar(...) declare void @llvm.instrprof.increment(i8*, i64, i32, i32) #0 attributes #0 = { nounwind } !llvm.module.flags = !{!0, !1} !llvm.ident = !{!2} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 7, !"PIC Level", i32 2} !2 = !{!"clang version 6.0.0 (trunk 319373) (llvm/trunk 319391)"} |