[clang] 2ac025b - Make Multiversion Function Resolvers set CurFn (#209918)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 15 17:54:56 PDT 2026
Author: Erich Keane
Date: 2026-07-15T20:54:51-04:00
New Revision: 2ac025b406e9b62ca3ae0af42a3d9d5dc649c234
URL: https://github.com/llvm/llvm-project/commit/2ac025b406e9b62ca3ae0af42a3d9d5dc649c234
DIFF: https://github.com/llvm/llvm-project/commit/2ac025b406e9b62ca3ae0af42a3d9d5dc649c234.diff
LOG: Make Multiversion Function Resolvers set CurFn (#209918)
Commit #197789 manages to try to reference CurFn while generating a
trap, which some of the multiversion resolvers do. This patch makes sure
we set it to the resolver so we are inserting stuff into the right
places.
This somewhat shockingly causes no tests to fail, but it SHOULD stop the
UBSan failures.
Added:
Modified:
clang/lib/CodeGen/CodeGenFunction.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 7629b42dd313d..fc4c7ea40f03d 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -48,6 +48,7 @@
#include "llvm/IR/IntrinsicsPowerPC.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/Support/CRC.h"
+#include "llvm/Support/SaveAndRestore.h"
#include "llvm/Support/SipHash.h"
#include "llvm/Support/xxhash.h"
#include "llvm/Transforms/Scalar/LowerExpectIntrinsic.h"
@@ -3066,7 +3067,7 @@ static void CreateMultiVersionResolverReturn(CodeGenModule &CGM,
void CodeGenFunction::EmitMultiVersionResolver(
llvm::Function *Resolver, ArrayRef<FMVResolverOption> Options) {
-
+ llvm::SaveAndRestore<llvm::Function *> savedCurFn(CurFn, Resolver);
llvm::Triple::ArchType ArchType =
getContext().getTargetInfo().getTriple().getArch();
More information about the cfe-commits
mailing list