Changing the LLVM C API to remove a pass

Hi,

I have finished migrating all of the simplify-libcalls pass
functionality into instcombine
and functionattrs. Now I am ready to completely to remove what is
left of the pass from
the source tree. However, there are a few C API functions for
creating and managing
the pass:

   /** See llvm::PassManagerBuilder::DisableSimplifyLibCalls */
   void
   LLVMPassManagerBuilderSetDisableSimplifyLibCalls(LLVMPassManagerBuilderRef
PMB,

          LLVMBool Value);

   /** See llvm::createSimplifyLibCallsPass function. */
   void LLVMAddSimplifyLibCallsPass(LLVMPassManagerRef PM);

Is it OK to remove these? Do I need to keep them? Or is there some
sort of deprecation process?

-- Meador

Hi Meador,

I have finished migrating all of the simplify-libcalls pass
functionality into instcombine
and functionattrs. Now I am ready to completely to remove what is
left of the pass from
the source tree. However, there are a few C API functions for
creating and managing
the pass:

    /** See llvm::PassManagerBuilder::DisableSimplifyLibCalls */
    void
    LLVMPassManagerBuilderSetDisableSimplifyLibCalls(LLVMPassManagerBuilderRef
PMB,

           LLVMBool Value);

    /** See llvm::createSimplifyLibCallsPass function. */
    void LLVMAddSimplifyLibCallsPass(LLVMPassManagerRef PM);

Is it OK to remove these? Do I need to keep them? Or is there some
sort of deprecation process?

I think you should try to keep them. I guess LLVMAddSimplifyLibCallsPass can be
changed to do nothing (or produce a warning). Probably
LLVMPassManagerBuilderSetDisableSimplifyLibCalls
should somehow prevent libcall simplification.

Ciao, Duncan.

I don't see how we can prevent libcall simplification for all cases with the C
API. The issue is that the only way to completely disable library call
simplifications now is by calling TargetLibraryInfo::disableAllFunctions. The
various tools (opt, clang, etc...) do exactly this.

I don't see how the equivalent can be accomplished behind
LLVMPassManagerBuilderSetDisableSimplifyLibCalls since we don't always have
access to the TLI. In some cases the TLI is set by assigning
PassManagerBuilder::LibraryInfo directly and by its C API
LLVMAddTargetLibraryInfo (although I don't see how this function is useful as I
don't see a way to *create* TargetLibraryInfo from the C API) and in other
cases it is added directly to the pass list after disableAllFunctions has
already been called on it, which is what I mentioned before that opt and clang
do.

I guess we could call disableAllFunctions for the first case where the TLI has
been directly set via LLVMAddTargetLibraryInfo.

Maybe I am just missing something?