[PATCH] D37866: [LateJumpThreading] Enable LateJumpThreading right before CGP.

Balaram Makam via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 14 14:30:10 PDT 2017


bmakam updated this revision to Diff 115288.
bmakam added a comment.

Address Krzysztof's comment.


https://reviews.llvm.org/D37866

Files:
  lib/CodeGen/CodeGenPrepare.cpp
  lib/CodeGen/TargetPassConfig.cpp


Index: lib/CodeGen/TargetPassConfig.cpp
===================================================================
--- lib/CodeGen/TargetPassConfig.cpp
+++ lib/CodeGen/TargetPassConfig.cpp
@@ -84,6 +84,8 @@
     cl::desc("Disable Loop Strength Reduction Pass"));
 static cl::opt<bool> DisableConstantHoisting("disable-constant-hoisting",
     cl::Hidden, cl::desc("Disable ConstantHoisting"));
+static cl::opt<bool> DisableLateJumpThreading("disable-late-jt", cl::Hidden,
+    cl::desc("Disable Late Jump Threading"));
 static cl::opt<bool> DisableCGP("disable-cgp", cl::Hidden,
     cl::desc("Disable Codegen Prepare"));
 static cl::opt<bool> DisableCopyProp("disable-copyprop", cl::Hidden,
@@ -664,6 +666,8 @@
 /// Add pass to prepare the LLVM IR for code generation. This should be done
 /// before exception handling preparation passes.
 void TargetPassConfig::addCodeGenPrepare() {
+  if (getOptLevel() != CodeGenOpt::None && !DisableLateJumpThreading)
+    addPass(createLateJumpThreadingPass());
   if (getOptLevel() != CodeGenOpt::None && !DisableCGP)
     addPass(createCodeGenPreparePass());
   addPass(createRewriteSymbolsPass());
Index: lib/CodeGen/CodeGenPrepare.cpp
===================================================================
--- lib/CodeGen/CodeGenPrepare.cpp
+++ lib/CodeGen/CodeGenPrepare.cpp
@@ -84,6 +84,7 @@
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Target/TargetSubtargetInfo.h"
+#include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
 #include "llvm/Transforms/Utils/BypassSlowDivision.h"
 #include "llvm/Transforms/Utils/Cloning.h"
@@ -266,6 +267,7 @@
       AU.addRequired<TargetLibraryInfoWrapperPass>();
       AU.addRequired<TargetTransformInfoWrapperPass>();
       AU.addRequired<LoopInfoWrapperPass>();
+      AU.addRequiredID(LoopSimplifyID);
     }
 
   private:
@@ -314,6 +316,7 @@
 
 INITIALIZE_PASS_BEGIN(CodeGenPrepare, DEBUG_TYPE,
                       "Optimize for code generation", false, false)
+INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
 INITIALIZE_PASS_DEPENDENCY(ProfileSummaryInfoWrapperPass)
 INITIALIZE_PASS_END(CodeGenPrepare, DEBUG_TYPE,
                     "Optimize for code generation", false, false)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37866.115288.patch
Type: text/x-patch
Size: 2242 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170914/d1b85d7c/attachment.bin>


More information about the llvm-commits mailing list