Skip to content

Commit

Permalink
[IPConstProp] Remove and move tests to SCCP.
Browse files Browse the repository at this point in the history
As far as I know, ipconstprop has not been used in years and ipsccp has
been used instead. This has the potential for confusion and sometimes
leads people to spend time finding & reporting bugs as well as
updating it to work with the latest API changes.

This patch moves the tests over to SCCP. There's one functional difference
I am aware of: ipconstprop propagates for each call-site individually, so
for functions that are called with different constant arguments it can sometimes
produce better results than ipsccp (at much higher compile-time cost).But
IPSCCP can be thought to do so as well for internal functions and as mentioned
earlier, the pass seems unused in practice (and there are no plans on working
towards enabling it anytime).

Also discussed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2020-July/143773.html

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D84447
  • Loading branch information
fhahn committed Jul 30, 2020
1 parent cc52928 commit e77624a
Show file tree
Hide file tree
Showing 29 changed files with 43 additions and 424 deletions.
1 change: 0 additions & 1 deletion llvm/bindings/go/llvm/transforms_ipo.go
Expand Up @@ -32,7 +32,6 @@ func (pm PassManager) AddFunctionAttrsPass() { C.LLVMAddFunctionAttrsPas
func (pm PassManager) AddFunctionInliningPass() { C.LLVMAddFunctionInliningPass(pm.C) }
func (pm PassManager) AddGlobalDCEPass() { C.LLVMAddGlobalDCEPass(pm.C) }
func (pm PassManager) AddGlobalOptimizerPass() { C.LLVMAddGlobalOptimizerPass(pm.C) }
func (pm PassManager) AddIPConstantPropagationPass() { C.LLVMAddIPConstantPropagationPass(pm.C) }
func (pm PassManager) AddPruneEHPass() { C.LLVMAddPruneEHPass(pm.C) }
func (pm PassManager) AddIPSCCPPass() { C.LLVMAddIPSCCPPass(pm.C) }
func (pm PassManager) AddInternalizePass(allButMain bool) {
Expand Down
6 changes: 0 additions & 6 deletions llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c
Expand Up @@ -73,12 +73,6 @@ CAMLprim value llvm_add_global_optimizer(LLVMPassManagerRef PM) {
return Val_unit;
}

/* [`Module] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_ip_constant_propagation(LLVMPassManagerRef PM) {
LLVMAddIPConstantPropagationPass(PM);
return Val_unit;
}

/* [`Module] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_prune_eh(LLVMPassManagerRef PM) {
LLVMAddPruneEHPass(PM);
Expand Down
5 changes: 0 additions & 5 deletions llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli
Expand Up @@ -56,11 +56,6 @@ external add_global_optimizer
: [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_global_optimizer"

(** See the [llvm::createIPConstantPropagationPass] function. *)
external add_ipc_propagation
: [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_ip_constant_propagation"

(** See the [llvm::createPruneEHPass] function. *)
external add_prune_eh
: [ `Module ] Llvm.PassManager.t -> unit
Expand Down
9 changes: 0 additions & 9 deletions llvm/docs/Passes.rst
Expand Up @@ -676,15 +676,6 @@ This pass loops over all of the functions in the input module, looking for a
main function. If a main function is found, all other functions and all global
variables with initializers are marked as internal.

``-ipconstprop``: Interprocedural constant propagation
------------------------------------------------------

This pass implements an *extremely* simple interprocedural constant propagation
pass. It could certainly be improved in many different ways, like using a
worklist. This pass makes arguments dead, but does not remove them. The
existing dead argument elimination pass should be run after this to clean up
the mess.

``-ipsccp``: Interprocedural Sparse Conditional Constant Propagation
--------------------------------------------------------------------

Expand Down
3 changes: 0 additions & 3 deletions llvm/include/llvm-c/Transforms/IPO.h
Expand Up @@ -57,9 +57,6 @@ void LLVMAddGlobalDCEPass(LLVMPassManagerRef PM);
/** See llvm::createGlobalOptimizerPass function. */
void LLVMAddGlobalOptimizerPass(LLVMPassManagerRef PM);

/** See llvm::createIPConstantPropagationPass function. */
void LLVMAddIPConstantPropagationPass(LLVMPassManagerRef PM);

/** See llvm::createPruneEHPass function. */
void LLVMAddPruneEHPass(LLVMPassManagerRef PM);

Expand Down
1 change: 0 additions & 1 deletion llvm/include/llvm/InitializePasses.h
Expand Up @@ -179,7 +179,6 @@ void initializeGuardWideningLegacyPassPass(PassRegistry&);
void initializeHardwareLoopsPass(PassRegistry&);
void initializeHotColdSplittingLegacyPassPass(PassRegistry&);
void initializeHWAddressSanitizerLegacyPassPass(PassRegistry &);
void initializeIPCPPass(PassRegistry&);
void initializeIPSCCPLegacyPassPass(PassRegistry&);
void initializeIRCELegacyPassPass(PassRegistry&);
void initializeIRTranslatorPass(PassRegistry&);
Expand Down
1 change: 0 additions & 1 deletion llvm/include/llvm/LinkAllPasses.h
Expand Up @@ -116,7 +116,6 @@ namespace {
(void) llvm::createGlobalsAAWrapperPass();
(void) llvm::createGuardWideningPass();
(void) llvm::createLoopGuardWideningPass();
(void) llvm::createIPConstantPropagationPass();
(void) llvm::createIPSCCPPass();
(void) llvm::createInductiveRangeCheckEliminationPass();
(void) llvm::createIndVarSimplifyPass();
Expand Down
6 changes: 0 additions & 6 deletions llvm/include/llvm/Transforms/IPO.h
Expand Up @@ -155,12 +155,6 @@ Pass *createArgumentPromotionPass(unsigned maxElements = 3);
/// createOpenMPOptLegacyPass - OpenMP specific optimizations.
Pass *createOpenMPOptLegacyPass();

//===----------------------------------------------------------------------===//
/// createIPConstantPropagationPass - This pass propagates constants from call
/// sites into the bodies of functions.
///
ModulePass *createIPConstantPropagationPass();

//===----------------------------------------------------------------------===//
/// createIPSCCPPass - This pass propagates constants from call sites into the
/// bodies of functions, and keeps track of whether basic blocks are executable
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/Transforms/IPO/CMakeLists.txt
Expand Up @@ -18,7 +18,6 @@ add_llvm_component_library(LLVMipo
GlobalOpt.cpp
GlobalSplit.cpp
HotColdSplitting.cpp
IPConstantPropagation.cpp
IPO.cpp
InferFunctionAttrs.cpp
InlineSimple.cpp
Expand Down

0 comments on commit e77624a

Please sign in to comment.