llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-codegen
@llvm/pr-subscribers-llvm-transforms
Author: Fangrui Song (MaskRay)
<details>
<summary>Changes</summary>
PR #<!-- -->167254 inappropriately introduced llvm/Support/Hash.{h,cpp} for the
KCFI helpers. The name is misleading - it has nothing to do with the
generic hashing facility in llvm/ADT/Hashing.h. KCFI is a CodeGen/IR
feature that does not belong in the foundational LLVMSupport.
Move the files to llvm/lib/Transforms/Utils/KCFIHash.cpp, alongside
setKCFIType, which is the only existing KCFI helper in TransformUtils.
---
Full diff: https://github.com/llvm/llvm-project/pull/196784.diff
7 Files Affected:
- (modified) clang/include/clang/Basic/CodeGenOptions.h (+1-1)
- (modified) clang/lib/CodeGen/CodeGenModule.cpp (+1-1)
- (renamed) llvm/include/llvm/Transforms/Utils/KCFIHash.h (+5-5)
- (modified) llvm/lib/Support/CMakeLists.txt (-1)
- (modified) llvm/lib/Transforms/Utils/CMakeLists.txt (+1)
- (renamed) llvm/lib/Transforms/Utils/KCFIHash.cpp (+2-6)
- (modified) llvm/lib/Transforms/Utils/ModuleUtils.cpp (+1-1)
``````````diff
diff --git a/clang/include/clang/Basic/CodeGenOptions.h
b/clang/include/clang/Basic/CodeGenOptions.h
index 3cbbf1a3074ac..e43112b4bb98b 100644
--- a/clang/include/clang/Basic/CodeGenOptions.h
+++ b/clang/include/clang/Basic/CodeGenOptions.h
@@ -22,10 +22,10 @@
#include "llvm/Frontend/Driver/CodeGenOptions.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/Support/CodeGen.h"
-#include "llvm/Support/Hash.h"
#include "llvm/Support/Regex.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Transforms/Instrumentation/AddressSanitizerOptions.h"
+#include "llvm/Transforms/Utils/KCFIHash.h"
#include <map>
#include <memory>
#include <string>
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp
b/clang/lib/CodeGen/CodeGenModule.cpp
index 106f1e63cd904..2d91b7eaa52dc 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -70,7 +70,6 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/Hash.h"
#include "llvm/Support/TimeProfiler.h"
#include "llvm/TargetParser/AArch64TargetParser.h"
#include "llvm/TargetParser/RISCVISAInfo.h"
@@ -78,6 +77,7 @@
#include "llvm/TargetParser/X86TargetParser.h"
#include "llvm/Transforms/Instrumentation/KCFI.h"
#include "llvm/Transforms/Utils/BuildLibCalls.h"
+#include "llvm/Transforms/Utils/KCFIHash.h"
#include <optional>
#include <set>
diff --git a/llvm/include/llvm/Support/Hash.h
b/llvm/include/llvm/Transforms/Utils/KCFIHash.h
similarity index 78%
rename from llvm/include/llvm/Support/Hash.h
rename to llvm/include/llvm/Transforms/Utils/KCFIHash.h
index 7a2cfb8774ae8..553c24d1289aa 100644
--- a/llvm/include/llvm/Support/Hash.h
+++ b/llvm/include/llvm/Transforms/Utils/KCFIHash.h
@@ -1,4 +1,4 @@
-//===- llvm/Support/Hash.h - Hash functions --------------------*- C++ -*-===//
+//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
//
-// This file provides hash functions.
+// Helpers for computing the 32-bit KCFI type ID from a mangled type name.
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_SUPPORT_HASH_H
-#define LLVM_SUPPORT_HASH_H
+#ifndef LLVM_TRANSFORMS_UTILS_KCFIHASH_H
+#define LLVM_TRANSFORMS_UTILS_KCFIHASH_H
#include "llvm/ADT/StringRef.h"
#include <cstdint>
@@ -34,4 +34,4 @@ LLVM_ABI uint32_t getKCFITypeID(StringRef MangledTypeName,
} // end namespace llvm
-#endif // LLVM_SUPPORT_HASH_H
+#endif // LLVM_TRANSFORMS_UTILS_KCFIHASH_H
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index e8d505f218b69..100cfb567c348 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -204,7 +204,6 @@ add_llvm_component_library(LLVMSupport
FormatVariadic.cpp
GlobPattern.cpp
GraphWriter.cpp
- Hash.cpp
HexagonAttributeParser.cpp
HexagonAttributes.cpp
InitLLVM.cpp
diff --git a/llvm/lib/Transforms/Utils/CMakeLists.txt
b/llvm/lib/Transforms/Utils/CMakeLists.txt
index 82e9edf674866..933e204081ad2 100644
--- a/llvm/lib/Transforms/Utils/CMakeLists.txt
+++ b/llvm/lib/Transforms/Utils/CMakeLists.txt
@@ -40,6 +40,7 @@ add_llvm_component_library(LLVMTransformUtils
Instrumentation.cpp
IntegerDivision.cpp
IRNormalizer.cpp
+ KCFIHash.cpp
LCSSA.cpp
LibCallsShrinkWrap.cpp
Local.cpp
diff --git a/llvm/lib/Support/Hash.cpp b/llvm/lib/Transforms/Utils/KCFIHash.cpp
similarity index 91%
rename from llvm/lib/Support/Hash.cpp
rename to llvm/lib/Transforms/Utils/KCFIHash.cpp
index 6b5d000ee27c9..b02163e84ca78 100644
--- a/llvm/lib/Support/Hash.cpp
+++ b/llvm/lib/Transforms/Utils/KCFIHash.cpp
@@ -1,16 +1,12 @@
-//===- Hash.cpp - Hash functions ---------------------------------------===//
+//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
-//
-// This file implements hash functions.
-//
-//===----------------------------------------------------------------------===//
-#include "llvm/Support/Hash.h"
+#include "llvm/Transforms/Utils/KCFIHash.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/xxhash.h"
diff --git a/llvm/lib/Transforms/Utils/ModuleUtils.cpp
b/llvm/lib/Transforms/Utils/ModuleUtils.cpp
index 63a234960a0ad..2976ebf46c9b7 100644
--- a/llvm/lib/Transforms/Utils/ModuleUtils.cpp
+++ b/llvm/lib/Transforms/Utils/ModuleUtils.cpp
@@ -19,9 +19,9 @@
#include "llvm/IR/MDBuilder.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/Hash.h"
#include "llvm/Support/MD5.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Transforms/Utils/KCFIHash.h"
using namespace llvm;
``````````
</details>
https://github.com/llvm/llvm-project/pull/196784
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits