[clang] [llvm] [compiler-rt] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 1 10:14:43 PDT 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 7c2ef38c36eda2907cd6a3efff88bb86a1b381a3 82fac8e25798772862c52a6b31ef09f6a2be4757 -- clang/include/clang/Basic/CodeGenOptions.h clang/lib/CodeGen/CGVTables.cpp clang/lib/CodeGen/MicrosoftCXXABI.cpp compiler-rt/lib/profile/InstrProfiling.h compiler-rt/lib/profile/InstrProfilingBuffer.c compiler-rt/lib/profile/InstrProfilingInternal.h compiler-rt/lib/profile/InstrProfilingMerge.c compiler-rt/lib/profile/InstrProfilingPlatformLinux.c compiler-rt/lib/profile/InstrProfilingWriter.c llvm/include/llvm/Analysis/IndirectCallVisitor.h llvm/include/llvm/ProfileData/InstrProf.h llvm/include/llvm/ProfileData/InstrProfReader.h llvm/include/llvm/ProfileData/InstrProfWriter.h llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h llvm/lib/ProfileData/InstrProf.cpp llvm/lib/ProfileData/InstrProfReader.cpp llvm/lib/ProfileData/InstrProfWriter.cpp llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp llvm/tools/llvm-profdata/llvm-profdata.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/include/clang/Basic/CodeGenOptions.h b/clang/include/clang/Basic/CodeGenOptions.h
index fe013a49ff51..f81bbed65895 100644
--- a/clang/include/clang/Basic/CodeGenOptions.h
+++ b/clang/include/clang/Basic/CodeGenOptions.h
@@ -488,7 +488,7 @@ public:
     return getProfileInstr() == ProfileClangInstr;
   }
 
-   // Returns true if IR level profile instrumentation or use is on;
+  // Returns true if IR level profile instrumentation or use is on;
   // returns true for CS IR instrumentation or profile use as well.
   bool hasProfileIRInstrOrUse() const {
     // For CS IR PGO, hasProfileIRUse is true for both instrumentation
diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp
index 5b4d17926a12..e8cef3dbf7c4 100644
--- a/clang/lib/CodeGen/CGVTables.cpp
+++ b/clang/lib/CodeGen/CGVTables.cpp
@@ -1312,7 +1312,7 @@ llvm::GlobalObject::VCallVisibility CodeGenModule::GetVCallVisibilityLevel(
 void CodeGenModule::EmitVTableTypeMetadata(const CXXRecordDecl *RD,
                                            llvm::GlobalVariable *VTable,
                                            const VTableLayout &VTLayout) {
-  if (!getCodeGenOpts().LTOUnit &&!getCodeGenOpts().hasProfileIRInstrOrUse())
+  if (!getCodeGenOpts().LTOUnit && !getCodeGenOpts().hasProfileIRInstrOrUse())
     return;
 
   CharUnits ComponentWidth = GetTargetTypeStoreSize(getVTableComponentType());
diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
index 14a2146bbdcd..ce33abd03571 100644
--- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp
+++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -1674,7 +1674,7 @@ void MicrosoftCXXABI::emitVTableTypeMetadata(const VPtrInfo &Info,
                                              const CXXRecordDecl *RD,
                                              llvm::GlobalVariable *VTable) {
   if (!CGM.getCodeGenOpts().LTOUnit &&
-   !CGM.getCodeGenOpts().hasProfileIRInstrOrUse())
+      !CGM.getCodeGenOpts().hasProfileIRInstrOrUse())
     return;
 
   // TODO: Should VirtualFunctionElimination also be supported here?
diff --git a/llvm/include/llvm/ProfileData/InstrProf.h b/llvm/include/llvm/ProfileData/InstrProf.h
index d8c716625c90..8c5ea3e4a9ba 100644
--- a/llvm/include/llvm/ProfileData/InstrProf.h
+++ b/llvm/include/llvm/ProfileData/InstrProf.h
@@ -564,8 +564,9 @@ public:
     AddrToMD5Map.push_back(std::make_pair(Addr, MD5Val));
   }
 
-  /// Map the address range (i.e., [start_address, end_address]) of a variable to
-  /// its names' MD5 hash. This interface is only used by the raw profile header.
+  /// Map the address range (i.e., [start_address, end_address]) of a variable
+  /// to its names' MD5 hash. This interface is only used by the raw profile
+  /// header.
   void mapVTableAddress(uint64_t StartAddr, uint64_t EndAddr, uint64_t MD5Val) {
     VTableAddrRangeToMD5Map.push_back(
         std::make_pair(std::make_pair(StartAddr, EndAddr), MD5Val));

``````````

</details>


https://github.com/llvm/llvm-project/pull/66825


More information about the cfe-commits mailing list