[clang] 2b8d6fa - Revert "[PGO] Fix computation of function Hash"
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Mon May 25 11:14:40 PDT 2020
Author: Benjamin Kramer
Date: 2020-05-25T20:14:28+02:00
New Revision: 2b8d6fa0acacba4dee31ed618a5596414b2279d5
URL: https://github.com/llvm/llvm-project/commit/2b8d6fa0acacba4dee31ed618a5596414b2279d5
DIFF: https://github.com/llvm/llvm-project/commit/2b8d6fa0acacba4dee31ed618a5596414b2279d5.diff
LOG: Revert "[PGO] Fix computation of function Hash"
This reverts commit 7c298c104bfe725d4315926a656263e8a5ac3054.
Fails make check-clang.
Failing Tests (8):
Clang :: Profile/c-counter-overflows.c
Clang :: Profile/c-general.c
Clang :: Profile/c-unprofiled-blocks.c
Clang :: Profile/cxx-rangefor.cpp
Clang :: Profile/cxx-throws.cpp
Clang :: Profile/misexpect-switch-default.c
Clang :: Profile/misexpect-switch-nonconst.c
Clang :: Profile/misexpect-switch.c
Added:
Modified:
clang/lib/CodeGen/CodeGenPGO.cpp
Removed:
clang/test/Profile/c-collision.c
################################################################################
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp
index 98827bc3eec5..3c91a04d5464 100644
--- a/clang/lib/CodeGen/CodeGenPGO.cpp
+++ b/clang/lib/CodeGen/CodeGenPGO.cpp
@@ -747,15 +747,13 @@ uint64_t PGOHash::finalize() {
return Working;
// Check for remaining work in Working.
- if (Working) {
- using namespace llvm::support;
- uint64_t Swapped = endian::byte_swap<uint64_t, little>(Working);
- MD5.update(llvm::makeArrayRef((uint8_t *)&Swapped, sizeof(Swapped)));
- }
+ if (Working)
+ MD5.update(Working);
// Finalize the MD5 and return the hash.
llvm::MD5::MD5Result Result;
MD5.final(Result);
+ using namespace llvm::support;
return Result.low();
}
diff --git a/clang/test/Profile/c-collision.c b/clang/test/Profile/c-collision.c
deleted file mode 100644
index fabecd752b4e..000000000000
--- a/clang/test/Profile/c-collision.c
+++ /dev/null
@@ -1,22 +0,0 @@
-// Test that a slight change in the code leads to a
diff erent hash.
-// RUN: %clang_cc1 -UEXTRA -triple x86_64-unknown-linux-gnu -main-file-name c-collision.c %s -o - -emit-llvm -fprofile-instrument=clang | FileCheck %s --check-prefix=CHECK-NOEXTRA
-// RUN: %clang_cc1 -DEXTRA -triple x86_64-unknown-linux-gnu -main-file-name c-collision.c %s -o - -emit-llvm -fprofile-instrument=clang | FileCheck %s --check-prefix=CHECK-EXTRA
-
-// CHECK-NOEXTRA: @__profd_foo = private global { {{.*}} } { i64 6699318081062747564, i64 7156072912471487002,
-// CHECK-EXTRA: @__profd_foo = private global { {{.*}} } { i64 6699318081062747564, i64 -4383447408116050035,
-
-extern int bar;
-void foo() {
- if (bar) {
- }
- if (bar) {
- }
- if (bar) {
- if (bar) {
-#ifdef EXTRA
- if (bar) {
- }
-#endif
- }
- }
-}
More information about the cfe-commits
mailing list