From 54e03d03a7a4d47f09d40bcbcfe484066a52a077 Mon Sep 17 00:00:00 2001 From: Rong Xu Date: Mon, 14 Dec 2020 15:54:28 -0800 Subject: [PGO] Verify BFI counts after loading profile data This patch adds the functionality to compare BFI counts with real profile counts right after reading the profile. It will print remarks under -Rpass-analysis=pgo, or the internal option -pass-remarks-analysis=pgo. Differential Revision: https://reviews.llvm.org/D91813 --- clang/lib/CodeGen/CodeGenModule.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 0bb9c91f2434..dec0cba84343 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1744,6 +1744,13 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D, B.addAttribute(llvm::Attribute::OptimizeForSize); B.addAttribute(llvm::Attribute::Cold); } + if (D->hasAttr()) { + if (!ShouldAddOptNone) + B.addAttribute(llvm::Attribute::OptimizeForSize); + // xur + // B.addAttribute(llvm::Attribute::Hot); + fprintf(stderr, "hihi 1\n"); + } if (D->hasAttr()) B.addAttribute(llvm::Attribute::MinSize); -- cgit v1.2.3