[PATCH] D129413: [InstrProf] Allow compiler generated functions in SCL
ellis abandoned this revision. ellis added a comment. The function `__clang_call_terminate` seems to be a special case that clang builds itself. This diff might be too much for this rare specific case. Closing. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129413/new/ https://reviews.llvm.org/D129413 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D129413: [InstrProf] Allow compiler generated functions in SCL
ellis planned changes to this revision. ellis added inline comments. Comment at: clang/lib/CodeGen/CodeGenModule.cpp:3894-3896 + if (getCodeGenOpts().getProfileInstr() != CodeGenOptions::ProfileNone) +if (isProfileInstrExcluded(F, SourceLocation())) + F->addFnAttr(llvm::Attribute::NoProfile); ellis wrote: > phosek wrote: > > Do we still need > > https://github.com/llvm/llvm-project/blob/759e5e0096f650515799805828f9ac5b7d4a7303/clang/lib/CodeGen/CodeGenFunction.cpp#L856 > > if we set the attribute here? > Both are needed. Here the attribute is added in `GetOrCreateLLVMFunction()` > which I believe only creates compiler generated functions. Where you linked > is called when normal functions are generated. Oh sorry, I was mistaken. I'd like to figure out how to only have this code in one location. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129413/new/ https://reviews.llvm.org/D129413 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D129413: [InstrProf] Allow compiler generated functions in SCL
phosek accepted this revision. phosek added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129413/new/ https://reviews.llvm.org/D129413 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D129413: [InstrProf] Allow compiler generated functions in SCL
ellis added inline comments. Comment at: clang/lib/CodeGen/CodeGenModule.cpp:3894-3896 + if (getCodeGenOpts().getProfileInstr() != CodeGenOptions::ProfileNone) +if (isProfileInstrExcluded(F, SourceLocation())) + F->addFnAttr(llvm::Attribute::NoProfile); phosek wrote: > Do we still need > https://github.com/llvm/llvm-project/blob/759e5e0096f650515799805828f9ac5b7d4a7303/clang/lib/CodeGen/CodeGenFunction.cpp#L856 > if we set the attribute here? Both are needed. Here the attribute is added in `GetOrCreateLLVMFunction()` which I believe only creates compiler generated functions. Where you linked is called when normal functions are generated. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129413/new/ https://reviews.llvm.org/D129413 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D129413: [InstrProf] Allow compiler generated functions in SCL
phosek added inline comments. Comment at: clang/lib/CodeGen/CodeGenModule.cpp:3894-3896 + if (getCodeGenOpts().getProfileInstr() != CodeGenOptions::ProfileNone) +if (isProfileInstrExcluded(F, SourceLocation())) + F->addFnAttr(llvm::Attribute::NoProfile); Do we still need https://github.com/llvm/llvm-project/blob/759e5e0096f650515799805828f9ac5b7d4a7303/clang/lib/CodeGen/CodeGenFunction.cpp#L856 if we set the attribute here? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129413/new/ https://reviews.llvm.org/D129413 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D129413: [InstrProf] Allow compiler generated functions in SCL
ellis created this revision. Herald added a project: All. ellis retitled this revision from "[instrprof] Allow compiler generated functions in SCL" to "[InstrProf] Allow compiler generated functions in SCL". ellis edited the summary of this revision. ellis added reviewers: kyulee, phosek. ellis published this revision for review. Herald added a project: clang. Herald added a subscriber: cfe-commits. Allow compiler generated functions like `__clang_call_terminate` to be blocked in the special case list (SCL) passed by the `-fprofile-list=` option. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D129413 Files: clang/lib/CodeGen/CodeGenModule.cpp clang/test/CodeGen/profile-filter-compiler-generated.cpp Index: clang/test/CodeGen/profile-filter-compiler-generated.cpp === --- /dev/null +++ clang/test/CodeGen/profile-filter-compiler-generated.cpp @@ -0,0 +1,9 @@ +// RUN: echo "!fun:__clang_call_terminate" > %t.list +// RUN: %clang -fprofile-generate -fprofile-list=%t.list -Wno-exceptions -emit-llvm -S %s -o - | FileCheck %s + +// CHECK-NOT: noprofile +// CHECK-LABEL: define {{.*}} i32 @_Z3foov() +int foo() noexcept { throw 0; } + +// CHECK: noprofile +// CHECK-LABEL: define {{.*}} void @__clang_call_terminate( Index: clang/lib/CodeGen/CodeGenModule.cpp === --- clang/lib/CodeGen/CodeGenModule.cpp +++ clang/lib/CodeGen/CodeGenModule.cpp @@ -3891,6 +3891,10 @@ F->addFnAttrs(B); } + if (getCodeGenOpts().getProfileInstr() != CodeGenOptions::ProfileNone) +if (isProfileInstrExcluded(F, SourceLocation())) + F->addFnAttr(llvm::Attribute::NoProfile); + if (!DontDefer) { // All MSVC dtors other than the base dtor are linkonce_odr and delegate to // each other bottoming out with the base dtor. Therefore we emit non-base Index: clang/test/CodeGen/profile-filter-compiler-generated.cpp === --- /dev/null +++ clang/test/CodeGen/profile-filter-compiler-generated.cpp @@ -0,0 +1,9 @@ +// RUN: echo "!fun:__clang_call_terminate" > %t.list +// RUN: %clang -fprofile-generate -fprofile-list=%t.list -Wno-exceptions -emit-llvm -S %s -o - | FileCheck %s + +// CHECK-NOT: noprofile +// CHECK-LABEL: define {{.*}} i32 @_Z3foov() +int foo() noexcept { throw 0; } + +// CHECK: noprofile +// CHECK-LABEL: define {{.*}} void @__clang_call_terminate( Index: clang/lib/CodeGen/CodeGenModule.cpp === --- clang/lib/CodeGen/CodeGenModule.cpp +++ clang/lib/CodeGen/CodeGenModule.cpp @@ -3891,6 +3891,10 @@ F->addFnAttrs(B); } + if (getCodeGenOpts().getProfileInstr() != CodeGenOptions::ProfileNone) +if (isProfileInstrExcluded(F, SourceLocation())) + F->addFnAttr(llvm::Attribute::NoProfile); + if (!DontDefer) { // All MSVC dtors other than the base dtor are linkonce_odr and delegate to // each other bottoming out with the base dtor. Therefore we emit non-base ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits