[PATCH] D85047: [Hexagon] Use InstCombine instead of ConstantPropThis is the last remaining use of ConstantProp, migrate it to InstCombine in the goal of removing ConstantProp.

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 14:47:05 PDT 2020


aeubanks created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
aeubanks requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85047

Files:
  llvm/include/llvm/Transforms/InstCombine/InstCombine.h
  llvm/include/llvm/Transforms/Scalar.h
  llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
  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
@@ -101,6 +101,7 @@
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Transforms/InstCombine/InstCombine.h"
 #include "llvm/Transforms/InstCombine/InstCombineWorklist.h"
+#include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Utils/Local.h"
 #include <algorithm>
 #include <cassert>
Index: llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
===================================================================
--- llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
+++ llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
@@ -312,7 +312,7 @@
   bool NoOpt = (getOptLevel() == CodeGenOpt::None);
 
   if (!NoOpt) {
-    addPass(createConstantPropagationPass());
+    addPass(createInstructionCombiningPass());
     addPass(createDeadCodeEliminationPass());
   }
 
Index: llvm/include/llvm/Transforms/Scalar.h
===================================================================
--- llvm/include/llvm/Transforms/Scalar.h
+++ llvm/include/llvm/Transforms/Scalar.h
@@ -530,6 +530,22 @@
 // transformations.
 //
 Pass *createWarnMissedTransformationsPass();
+
+//===----------------------------------------------------------------------===//
+//
+// InstructionCombining - Combine instructions to form fewer, simple
+// instructions. This pass does not modify the CFG, and has a tendency to make
+// instructions dead, so a subsequent DCE pass is useful.
+//
+// This pass combines things like:
+//    %Y = add int 1, %X
+//    %Z = add int 1, %Y
+// into:
+//    %Z = add int 2, %X
+//
+FunctionPass *createInstructionCombiningPass();
+FunctionPass *createInstructionCombiningPass(unsigned MaxIterations);
+
 } // End llvm namespace
 
 #endif
Index: llvm/include/llvm/Transforms/InstCombine/InstCombine.h
===================================================================
--- llvm/include/llvm/Transforms/InstCombine/InstCombine.h
+++ llvm/include/llvm/Transforms/InstCombine/InstCombine.h
@@ -52,21 +52,6 @@
   void getAnalysisUsage(AnalysisUsage &AU) const override;
   bool runOnFunction(Function &F) override;
 };
-
-//===----------------------------------------------------------------------===//
-//
-// InstructionCombining - Combine instructions to form fewer, simple
-// instructions. This pass does not modify the CFG, and has a tendency to make
-// instructions dead, so a subsequent DCE pass is useful.
-//
-// This pass combines things like:
-//    %Y = add int 1, %X
-//    %Z = add int 1, %Y
-// into:
-//    %Z = add int 2, %X
-//
-FunctionPass *createInstructionCombiningPass();
-FunctionPass *createInstructionCombiningPass(unsigned MaxIterations);
 }
 
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85047.282319.patch
Type: text/x-patch
Size: 2834 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200731/9b18b110/attachment.bin>


More information about the llvm-commits mailing list