[llvm] [CFI] Use .cfi of aleasee if the function is infact a alias (PR #150339)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 23 15:51:41 PDT 2025
https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/150339
Merged unit contains jump tables, but no
definition target functions. For each function
with canonical jump table it expects, that the
module with definition will rename function into
".cfi" version. However, it does not happend for
aliases. To overcome that we will use .cfi version
of aliasee.
Fixes #150075.
>From c86c2a24f44ffd9e0af8a7587d6e1f080311b27e Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Wed, 23 Jul 2025 15:51:27 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.6
---
llvm/lib/Transforms/IPO/LowerTypeTests.cpp | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
index 486205c8a3848..43f22bcc892ef 100644
--- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
+++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
@@ -2453,6 +2453,17 @@ bool LowerTypeTestsModule::lower() {
} else {
Alias->setName(AliasName);
}
+
+ if (auto *F = M.getFunction((AliasName + ".cfi").str())) {
+ // Function can be an alias. In such case we need definition of .cfi
+ // of aliasee.
+ if (auto *CfiAleasee = M.getFunction((Aliasee + ".cfi").str())) {
+ F->replaceAllUsesWith(CfiAleasee);
+ F->eraseFromParent();
+ } else {
+ F->setName(Aliasee + ".cfi");
+ }
+ }
}
}
}
More information about the llvm-commits
mailing list