[PATCH] D93838: [SCCP] Add Function Specialization pass

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 1 02:01:02 PDT 2021


fhahn added a comment.

In D93838#2784592 <https://reviews.llvm.org/D93838#2784592>, @SjoerdMeijer wrote:

> Ran clang-format.
>
> @fhahn:  about running the solver first before making IR changes. I think that is happening already. There are some places where the solver is kept up to date after transformations. I think this is a remainder of running function specialisation iteratively that I stripped out for now, but I think it's good to keep these updates to the solver as it's probably good to keep it consistent.

I'm not sure I'm looking at the right thing, but it looks like the specialization is still run iteratively via the code below? `RunSCCPSolver` seems to modify the IR after solving. Maybe I am looking at the wrong thing?

  while (FuncSpecializationMaxIters != I++ &&
         FS.specializeFunctions(FuncDecls, CurrentSpecializations)) {
  
    // Run solver for the specialized functions only.
    RunSCCPSolver(CurrentSpecializations);
  
    CurrentSpecializations.clear();
    Changed = true;
  }

Do we have test cases where the specialization leads to the function result of the specialized function becoming another constant, enabling further simplification in the caller?



================
Comment at: llvm/test/Transforms/FunctionSpecialization/function-specialization-recursive.ll:3
+
+; TODO: this needs looking into and fixing.
+; RUN: opt -function-specialization -inline -instcombine -S < %s | FileCheck %s
----------------
can you elaborate what is going wrong here and what needs fixing?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93838/new/

https://reviews.llvm.org/D93838



More information about the llvm-commits mailing list