[llvm] [llvm][GlobalOpt] Optimize statically resolvable IFuncs (PR #80606)

Jon Roelofs via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 5 14:38:05 PDT 2024


================
@@ -2404,6 +2405,42 @@ static bool OptimizeEmptyGlobalCXXDtors(Function *CXAAtExitFn) {
   return Changed;
 }
 
+static Function *hasSideeffectFreeStaticResolution(GlobalIFunc &IF) {
+  Function *Resolver = IF.getResolverFunction();
+  if (!Resolver)
+    return nullptr;
+
+  Function *Callee = nullptr;
+  for (BasicBlock &BB : *Resolver) {
----------------
jroelofs wrote:

> Also having to use the AArch64 Target Parser to create a constant mask, or looking for loads from address __aarch64_cpu_features doesn't fit well in a target independent optimization.

These feel like they could be served by TTI hooks.

https://github.com/llvm/llvm-project/pull/80606


More information about the llvm-commits mailing list