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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 05:40:15 PST 2024


================
@@ -2404,6 +2406,57 @@ static bool OptimizeEmptyGlobalCXXDtors(Function *CXAAtExitFn) {
   return Changed;
 }
 
+static Function *hasSideeffectFreeStaticResolution(GlobalIFunc &IF) {
+  Function *Resolver = IF.getResolverFunction();
+  if (!Resolver)
+    return nullptr;
+
+  if (Resolver->isInterposable())
----------------
nikic wrote:

This checks whether the resolver is interposable, but I think we have to guard against the ifunc itself being interposable as well.

At least this IR is accepted: https://llvm.godbolt.org/z/56vaWGM4q

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


More information about the llvm-commits mailing list