diff options
author | Hal Finkel <hfinkel@anl.gov> | 2014-09-07 20:05:11 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2014-09-07 20:05:11 +0000 |
commit | d67e4639016ec7bb1ad3e41b199f7ad11eaee09f (patch) | |
tree | d1972496fafdaf91ad83d0feb27bf2d078499446 /llvm/lib/Transforms/IPO/PassManagerBuilder.cpp | |
parent | 15aeaaf24adf73b4d9bbcc619fb6165fdb50591a (diff) | |
download | bcm5719-llvm-d67e4639016ec7bb1ad3e41b199f7ad11eaee09f.tar.gz bcm5719-llvm-d67e4639016ec7bb1ad3e41b199f7ad11eaee09f.zip |
Add an AlignmentFromAssumptions Pass
This adds a ScalarEvolution-powered transformation that updates load, store and
memory intrinsic pointer alignments based on invariant((a+q) & b == 0)
expressions. Many of the simple cases we can get with ValueTracking, but we
still need something like this for the more complicated cases (such as those
with an offset) that require some algebra. Note that gcc's
__builtin_assume_aligned's optional third argument provides exactly for this
kind of 'misalignment' offset for which this kind of logic is necessary.
The primary motivation is to fixup alignments for vector loads/stores after
vectorization (and unrolling). This pass is added to the optimization pipeline
just after the SLP vectorizer runs (which, admittedly, does not preserve SE,
although I imagine it could). Regardless, I actually don't think that the
preservation matters too much in this case: SE computes lazily, and this pass
won't issue any SE queries unless there are any assume intrinsics, so there
should be no real additional cost in the common case (SLP does preserve DT and
LoopInfo).
llvm-svn: 217344
Diffstat (limited to 'llvm/lib/Transforms/IPO/PassManagerBuilder.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/PassManagerBuilder.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp index 75714713172..fb56088d361 100644 --- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -310,6 +310,10 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) { if (!DisableUnrollLoops) MPM.add(createLoopUnrollPass()); // Unroll small loops + // After vectorization and unrolling, assume intrinsics may tell us more + // about pointer alignments. + MPM.add(createAlignmentFromAssumptionsPass()); + if (!DisableUnitAtATime) { // FIXME: We shouldn't bother with this anymore. MPM.add(createStripDeadPrototypesPass()); // Get rid of dead prototypes @@ -399,6 +403,10 @@ void PassManagerBuilder::addLTOOptimizationPasses(PassManagerBase &PM) { // More scalar chains could be vectorized due to more alias information PM.add(createSLPVectorizerPass()); // Vectorize parallel scalar chains. + // After vectorization, assume intrinsics may tell us more about pointer + // alignments. + PM.add(createAlignmentFromAssumptionsPass()); + if (LoadCombine) PM.add(createLoadCombinePass()); |