[llvm] [llvm][GlobalOpt] Optimize statically resolvable IFuncs (PR #80606)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 5 05:30:23 PST 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) {
----------------
nikic wrote:
This doesn't account for divergence effects (infinite loops). I'd recommend to only handle the case with a single basic block and rely on preceding simplification to reduce it to that form. (Unless there is a phase-ordering reason to believe this will not happen?)
https://github.com/llvm/llvm-project/pull/80606
More information about the llvm-commits
mailing list