[PATCH] D152641: [InstCombine] Remove unused function createInstructionCombiningPass

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 10 22:25:56 PDT 2023


kazu created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
kazu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The last use was removed by:

  commit 934c82d31801e65aa3bbe99a0e64f903621c2e04
  Author: Florian Hahn <flo at fhahn.com>
  Date:   Fri Feb 24 13:39:32 2023 +0100

Once I remove createInstructionCombiningPass, then:

InstructionCombiningPass::InstructionCombiningPass(unsigned MaxIterations)

becomes unused.  Once I remove that:

InstructionCombiningPass::MaxIterations is always initialized with
InstCombineDefaultMaxIterations, so this patch does the constant
propagation and removes InstructionCombiningPass::MaxIterations as
well.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152641

Files:
  llvm/include/llvm/Transforms/InstCombine/InstCombine.h
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp


Index: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -4161,18 +4161,13 @@
       nullptr;
 
   return combineInstructionsOverFunction(F, Worklist, AA, AC, TLI, TTI, DT, ORE,
-                                         BFI, PSI, MaxIterations, LI);
+                                         BFI, PSI,
+                                         InstCombineDefaultMaxIterations, LI);
 }
 
 char InstructionCombiningPass::ID = 0;
 
-InstructionCombiningPass::InstructionCombiningPass()
-    : FunctionPass(ID), MaxIterations(InstCombineDefaultMaxIterations) {
-  initializeInstructionCombiningPassPass(*PassRegistry::getPassRegistry());
-}
-
-InstructionCombiningPass::InstructionCombiningPass(unsigned MaxIterations)
-    : FunctionPass(ID), MaxIterations(MaxIterations) {
+InstructionCombiningPass::InstructionCombiningPass() : FunctionPass(ID) {
   initializeInstructionCombiningPassPass(*PassRegistry::getPassRegistry());
 }
 
@@ -4198,7 +4193,3 @@
 FunctionPass *llvm::createInstructionCombiningPass() {
   return new InstructionCombiningPass();
 }
-
-FunctionPass *llvm::createInstructionCombiningPass(unsigned MaxIterations) {
-  return new InstructionCombiningPass(MaxIterations);
-}
Index: llvm/include/llvm/Transforms/InstCombine/InstCombine.h
===================================================================
--- llvm/include/llvm/Transforms/InstCombine/InstCombine.h
+++ llvm/include/llvm/Transforms/InstCombine/InstCombine.h
@@ -63,13 +63,11 @@
 /// will try to combine all instructions in the function.
 class InstructionCombiningPass : public FunctionPass {
   InstructionWorklist Worklist;
-  const unsigned MaxIterations;
 
 public:
   static char ID; // Pass identification, replacement for typeid
 
   explicit InstructionCombiningPass();
-  explicit InstructionCombiningPass(unsigned MaxIterations);
 
   void getAnalysisUsage(AnalysisUsage &AU) const override;
   bool runOnFunction(Function &F) override;
@@ -88,7 +86,6 @@
 //    %Z = add int 2, %X
 //
 FunctionPass *createInstructionCombiningPass();
-FunctionPass *createInstructionCombiningPass(unsigned MaxIterations);
 }
 
 #undef DEBUG_TYPE


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152641.530271.patch
Type: text/x-patch
Size: 2318 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230611/adaf2219/attachment.bin>


More information about the llvm-commits mailing list