[llvm] [CFI] Use .cfi of aleasee if the function is infact a alias (PR #150339)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 23 15:52:12 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Vitaly Buka (vitalybuka)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/150339.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/IPO/LowerTypeTests.cpp (+11)
``````````diff
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");
+ }
+ }
}
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/150339
More information about the llvm-commits
mailing list