aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Passes/PassBuilderPipelines.cpp
diff options
context:
space:
mode:
authorDhruv Chawla <44582521+dc03@users.noreply.github.com>2023-07-20 10:57:19 +0530
committerDhruv Chawla <44582521+dc03@users.noreply.github.com>2023-09-20 12:03:36 +0530
commit0f152a55d3e4e71f7c795bf555e40c8895b97077 (patch)
tree617b5e19d2a44e806b0df17eb0ab5107c4b7082c /llvm/lib/Passes/PassBuilderPipelines.cpp
parent3978f37c0f1e368849ff594d9d603ec600010f7e (diff)
downloadllvm-0f152a55d3e4e71f7c795bf555e40c8895b97077.zip
llvm-0f152a55d3e4e71f7c795bf555e40c8895b97077.tar.gz
llvm-0f152a55d3e4e71f7c795bf555e40c8895b97077.tar.bz2
[InferAlignment] Implement InferAlignmentPass
This pass aims to infer alignment for instructions as a separate pass, to reduce redundant work done by InstCombine running multiple times. It runs late in the pipeline, just before the back-end passes where this information is most useful. Differential Revision: https://reviews.llvm.org/D158529
Diffstat (limited to 'llvm/lib/Passes/PassBuilderPipelines.cpp')
-rw-r--r--llvm/lib/Passes/PassBuilderPipelines.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index b12b4ee3..529743c 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -88,6 +88,7 @@
#include "llvm/Transforms/Scalar/Float2Int.h"
#include "llvm/Transforms/Scalar/GVN.h"
#include "llvm/Transforms/Scalar/IndVarSimplify.h"
+#include "llvm/Transforms/Scalar/InferAlignment.h"
#include "llvm/Transforms/Scalar/InstSimplifyPass.h"
#include "llvm/Transforms/Scalar/JumpThreading.h"
#include "llvm/Transforms/Scalar/LICM.h"
@@ -274,6 +275,11 @@ cl::opt<bool> EnableMemProfContextDisambiguation(
"enable-memprof-context-disambiguation", cl::init(false), cl::Hidden,
cl::ZeroOrMore, cl::desc("Enable MemProf context disambiguation"));
+cl::opt<bool> EnableInferAlignmentPass(
+ "enable-infer-alignment-pass", cl::init(false), cl::Hidden, cl::ZeroOrMore,
+ cl::desc("Enable the InferAlignment pass, disabling alignment inference in "
+ "InstCombine"));
+
PipelineTuningOptions::PipelineTuningOptions() {
LoopInterleaving = true;
LoopVectorization = true;
@@ -1140,6 +1146,8 @@ void PassBuilder::addVectorPasses(OptimizationLevel Level,
FPM.addPass(LoopVectorizePass(
LoopVectorizeOptions(!PTO.LoopInterleaving, !PTO.LoopVectorization)));
+ if (EnableInferAlignmentPass)
+ FPM.addPass(InferAlignmentPass());
if (IsFullLTO) {
// The vectorizer may have significantly shortened a loop body; unroll
// again. Unroll small loops to hide loop backedge latency and saturate any
@@ -1257,6 +1265,8 @@ void PassBuilder::addVectorPasses(OptimizationLevel Level,
FPM.addPass(SROAPass(SROAOptions::PreserveCFG));
}
+ if (EnableInferAlignmentPass)
+ FPM.addPass(InferAlignmentPass());
FPM.addPass(InstCombinePass());
// This is needed for two reasons: