diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -577,8 +577,8 @@ std::string Mangled; llvm::raw_string_ostream Out(Mangled); CGM.getCXXABI().getMangleContext().mangleTypeName(Ty, Out, false); - return llvm::ConstantInt::get(CGM.Int32Ty, - static_cast(llvm::xxHash64(Mangled))); + return llvm::ConstantInt::get( + CGM.Int32Ty, static_cast(llvm::xxh3_64bits(Mangled))); } void CodeGenFunction::EmitKernelMetadata(const FunctionDecl *FD, diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1998,8 +1998,8 @@ if (getCodeGenOpts().SanitizeCfiICallNormalizeIntegers) Out << ".normalized"; - return llvm::ConstantInt::get(Int32Ty, - static_cast(llvm::xxHash64(OutName))); + return llvm::ConstantInt::get( + Int32Ty, static_cast(llvm::xxh3_64bits(OutName))); } void CodeGenModule::SetLLVMFunctionAttributes(GlobalDecl GD, diff --git a/clang/test/CodeGen/kcfi-normalize.c b/clang/test/CodeGen/kcfi-normalize.c --- a/clang/test/CodeGen/kcfi-normalize.c +++ b/clang/test/CodeGen/kcfi-normalize.c @@ -10,24 +10,24 @@ void foo(void (*fn)(int), int arg) { // CHECK-LABEL: define{{.*}}foo // CHECK-SAME: {{.*}}!kcfi_type ![[TYPE1:[0-9]+]] - // CHECK: call void %0(i32 noundef %1){{.*}}[ "kcfi"(i32 1162514891) ] + // CHECK: call void %0(i32 noundef %1){{.*}}[ "kcfi"(i32 -168959710) ] fn(arg); } void bar(void (*fn)(int, int), int arg1, int arg2) { // CHECK-LABEL: define{{.*}}bar // CHECK-SAME: {{.*}}!kcfi_type ![[TYPE2:[0-9]+]] - // CHECK: call void %0(i32 noundef %1, i32 noundef %2){{.*}}[ "kcfi"(i32 448046469) ] + // CHECK: call void %0(i32 noundef %1, i32 noundef %2){{.*}}[ "kcfi"(i32 -993618679) ] fn(arg1, arg2); } void baz(void (*fn)(int, int, int), int arg1, int arg2, int arg3) { // CHECK-LABEL: define{{.*}}baz // CHECK-SAME: {{.*}}!kcfi_type ![[TYPE3:[0-9]+]] - // CHECK: call void %0(i32 noundef %1, i32 noundef %2, i32 noundef %3){{.*}}[ "kcfi"(i32 -2049681433) ] + // CHECK: call void %0(i32 noundef %1, i32 noundef %2, i32 noundef %3){{.*}}[ "kcfi"(i32 903305451) ] fn(arg1, arg2, arg3); } -// CHECK: ![[TYPE1]] = !{i32 -1143117868} -// CHECK: ![[TYPE2]] = !{i32 -460921415} -// CHECK: ![[TYPE3]] = !{i32 -333839615} +// CHECK: ![[TYPE1]] = !{i32 2050575439} +// CHECK: ![[TYPE2]] = !{i32 -1315331729} +// CHECK: ![[TYPE3]] = !{i32 565093442} diff --git a/clang/test/CodeGen/ubsan-function.cpp b/clang/test/CodeGen/ubsan-function.cpp --- a/clang/test/CodeGen/ubsan-function.cpp +++ b/clang/test/CodeGen/ubsan-function.cpp @@ -17,7 +17,7 @@ // CHECK: [[LABEL1]]: // CHECK: getelementptr <{ i32, i32 }>, ptr {{.*}}, i32 -1, i32 1, !nosanitize // CHECK: load i32, ptr {{.*}}, align {{.*}}, !nosanitize -// CHECK: icmp eq i32 {{.*}}, -1522505972, !nosanitize +// CHECK: icmp eq i32 {{.*}}, 905068220, !nosanitize // CHECK: br i1 {{.*}}, label %[[LABEL3:.*]], label %[[LABEL2:[^,]*]], {{.*}}!nosanitize // CHECK: [[LABEL2]]: // 64: call void @__ubsan_handle_function_type_mismatch_abort(ptr @[[#]], i64 %[[#]]) #[[#]], !nosanitize @@ -32,4 +32,4 @@ // CHECK-NEXT: ret void void caller(void (*f)()) { f(); } -// CHECK: ![[FUNCSAN]] = !{i32 -1056584962, i32 -1522505972} +// CHECK: ![[FUNCSAN]] = !{i32 -1056584962, i32 905068220} diff --git a/clang/test/CodeGenCXX/catch-undef-behavior.cpp b/clang/test/CodeGenCXX/catch-undef-behavior.cpp --- a/clang/test/CodeGenCXX/catch-undef-behavior.cpp +++ b/clang/test/CodeGenCXX/catch-undef-behavior.cpp @@ -405,7 +405,7 @@ // CalleeTypeHash check // CHECK: [[CalleeTypeHashPtr:%.+]] = getelementptr <{ i32, i32 }>, ptr [[PTR]], i32 -1, i32 1 // CHECK-NEXT: [[CalleeTypeHash:%.+]] = load i32, ptr [[CalleeTypeHashPtr]] - // CHECK-NEXT: [[CalleeTypeHashMatch:%.+]] = icmp eq i32 [[CalleeTypeHash]], 27004076 + // CHECK-NEXT: [[CalleeTypeHashMatch:%.+]] = icmp eq i32 [[CalleeTypeHash]], -1988405058 // CHECK-NEXT: br i1 [[CalleeTypeHashMatch]] p(42); @@ -740,4 +740,4 @@ // CHECK: attributes [[NR_NUW]] = { noreturn nounwind } -// CHECK-FUNCSAN: ![[FUNCSAN]] = !{i32 -1056584962, i32 -1302768377} +// CHECK-FUNCSAN: ![[FUNCSAN]] = !{i32 -1056584962, i32 -1000226989}