[llvm] r247263 - Add GlobalsAA as preserved to a bunch of transforms
Vaivaswatha Nagaraj via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 09:09:36 PDT 2015
Hi,
Should AlignmentFromAssumptions.cpp be modified too to preserve
AliasAnalysis (and in particular GlobalsAA). I'm using opt with
"-std-link-opts" and see that this pass is not preserving GlobalsAA and
hence LICM is under-performing.
Thanks,
- Vaivaswatha
On Thu, Sep 10, 2015 at 3:52 PM, James Molloy via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: jamesm
> Date: Thu Sep 10 05:22:12 2015
> New Revision: 247263
>
> URL: http://llvm.org/viewvc/llvm-project?rev=247263&view=rev
> Log:
> Add GlobalsAA as preserved to a bunch of transforms
>
> GlobalsAA must by definition be preserved in function passes, but the
> passmanager doesn't know that. Make each pass explicitly preserve GlobalsAA.
>
> Modified:
> llvm/trunk/lib/Transforms/Scalar/ADCE.cpp
> llvm/trunk/lib/Transforms/Scalar/BDCE.cpp
> llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
> llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp
> llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
> llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
> llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp
> llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
> llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
> llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp
> llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
> llvm/trunk/lib/Transforms/Scalar/SROA.cpp
> llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp
> llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp
>
> Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ADCE.cpp?rev=247263&r1=247262&r2=247263&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/ADCE.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Thu Sep 10 05:22:12 2015
> @@ -19,6 +19,7 @@
> #include "llvm/ADT/SmallPtrSet.h"
> #include "llvm/ADT/SmallVector.h"
> #include "llvm/ADT/Statistic.h"
> +#include "llvm/Analysis/GlobalsModRef.h"
> #include "llvm/IR/BasicBlock.h"
> #include "llvm/IR/CFG.h"
> #include "llvm/IR/InstIterator.h"
> @@ -42,6 +43,7 @@ struct ADCE : public FunctionPass {
>
> void getAnalysisUsage(AnalysisUsage& AU) const override {
> AU.setPreservesCFG();
> + AU.addPreserved<GlobalsAAWrapperPass>();
> }
> };
> }
>
> Modified: llvm/trunk/lib/Transforms/Scalar/BDCE.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/BDCE.cpp?rev=247263&r1=247262&r2=247263&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/BDCE.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/BDCE.cpp Thu Sep 10 05:22:12 2015
> @@ -17,6 +17,7 @@
> #include "llvm/Transforms/Scalar.h"
> #include "llvm/ADT/SmallVector.h"
> #include "llvm/ADT/Statistic.h"
> +#include "llvm/Analysis/GlobalsModRef.h"
> #include "llvm/Analysis/DemandedBits.h"
> #include "llvm/IR/CFG.h"
> #include "llvm/IR/InstIterator.h"
> @@ -45,6 +46,7 @@ struct BDCE : public FunctionPass {
> void getAnalysisUsage(AnalysisUsage& AU) const override {
> AU.setPreservesCFG();
> AU.addRequired<DemandedBits>();
> + AU.addPreserved<GlobalsAAWrapperPass>();
> }
> };
> }
>
> Modified: llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp?rev=247263&r1=247262&r2=247263&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
> (original)
> +++ llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp Thu
> Sep 10 05:22:12 2015
> @@ -13,6 +13,7 @@
>
> #include "llvm/Transforms/Scalar.h"
> #include "llvm/ADT/Statistic.h"
> +#include "llvm/Analysis/GlobalsModRef.h"
> #include "llvm/Analysis/InstructionSimplify.h"
> #include "llvm/Analysis/LazyValueInfo.h"
> #include "llvm/IR/CFG.h"
> @@ -54,6 +55,7 @@ namespace {
>
> void getAnalysisUsage(AnalysisUsage &AU) const override {
> AU.addRequired<LazyValueInfo>();
> + AU.addPreserved<GlobalsAAWrapperPass>();
> }
> };
> }
>
> Modified: llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp?rev=247263&r1=247262&r2=247263&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp Thu Sep 10 05:22:12 2015
> @@ -16,6 +16,7 @@
> #include "llvm/ADT/Hashing.h"
> #include "llvm/ADT/ScopedHashTable.h"
> #include "llvm/ADT/Statistic.h"
> +#include "llvm/Analysis/GlobalsModRef.h"
> #include "llvm/Analysis/AssumptionCache.h"
> #include "llvm/Analysis/InstructionSimplify.h"
> #include "llvm/Analysis/TargetLibraryInfo.h"
> @@ -772,6 +773,7 @@ public:
> AU.addRequired<DominatorTreeWrapperPass>();
> AU.addRequired<TargetLibraryInfoWrapperPass>();
> AU.addRequired<TargetTransformInfoWrapperPass>();
> + AU.addPreserved<GlobalsAAWrapperPass>();
> AU.setPreservesCFG();
> }
> };
>
> Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=247263&r1=247262&r2=247263&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Thu Sep 10
> 05:22:12 2015
> @@ -28,6 +28,7 @@
> #include "llvm/ADT/DenseMap.h"
> #include "llvm/ADT/SmallVector.h"
> #include "llvm/ADT/Statistic.h"
> +#include "llvm/Analysis/GlobalsModRef.h"
> #include "llvm/Analysis/LoopInfo.h"
> #include "llvm/Analysis/LoopPass.h"
> #include "llvm/Analysis/ScalarEvolutionExpander.h"
> @@ -112,6 +113,7 @@ namespace {
> AU.addRequired<ScalarEvolutionWrapperPass>();
> AU.addRequiredID(LoopSimplifyID);
> AU.addRequiredID(LCSSAID);
> + AU.addPreserved<GlobalsAAWrapperPass>();
> AU.addPreserved<ScalarEvolutionWrapperPass>();
> AU.addPreservedID(LoopSimplifyID);
> AU.addPreservedID(LCSSAID);
>
> Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=247263&r1=247262&r2=247263&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Thu Sep 10 05:22:12
> 2015
> @@ -18,6 +18,7 @@
> #include "llvm/ADT/SmallPtrSet.h"
> #include "llvm/ADT/SmallSet.h"
> #include "llvm/ADT/Statistic.h"
> +#include "llvm/Analysis/GlobalsModRef.h"
> #include "llvm/Analysis/CFG.h"
> #include "llvm/Analysis/ConstantFolding.h"
> #include "llvm/Analysis/InstructionSimplify.h"
> @@ -114,6 +115,7 @@ namespace {
> void getAnalysisUsage(AnalysisUsage &AU) const override {
> AU.addRequired<LazyValueInfo>();
> AU.addPreserved<LazyValueInfo>();
> + AU.addPreserved<GlobalsAAWrapperPass>();
> AU.addRequired<TargetLibraryInfoWrapperPass>();
> }
>
>
> Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp?rev=247263&r1=247262&r2=247263&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Thu Sep 10 05:22:12
> 2015
> @@ -17,6 +17,7 @@
> #include "llvm/Transforms/Scalar.h"
> #include "llvm/ADT/SmallVector.h"
> #include "llvm/ADT/Statistic.h"
> +#include "llvm/Analysis/GlobalsModRef.h"
> #include "llvm/Analysis/LoopPass.h"
> #include "llvm/Analysis/ScalarEvolution.h"
> #include "llvm/IR/Dominators.h"
> @@ -47,6 +48,7 @@ namespace {
> AU.addPreserved<ScalarEvolutionWrapperPass>();
> AU.addPreserved<DominatorTreeWrapperPass>();
> AU.addPreserved<LoopInfoWrapperPass>();
> + AU.addPreserved<GlobalsAAWrapperPass>();
> AU.addPreservedID(LoopSimplifyID);
> AU.addPreservedID(LCSSAID);
> }
>
> Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp?rev=247263&r1=247262&r2=247263&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp Thu Sep 10
> 05:22:12 2015
> @@ -14,6 +14,7 @@
>
> #include "llvm/Transforms/Scalar.h"
> #include "llvm/ADT/SetVector.h"
> +#include "llvm/Analysis/GlobalsModRef.h"
> #include "llvm/Analysis/AssumptionCache.h"
> #include "llvm/Analysis/CodeMetrics.h"
> #include "llvm/Analysis/InstructionSimplify.h"
> @@ -152,6 +153,7 @@ namespace {
> // loop will receive invalid dom info.
> // For now, recreate dom info, if loop is unrolled.
> AU.addPreserved<DominatorTreeWrapperPass>();
> + AU.addPreserved<GlobalsAAWrapperPass>();
> }
>
> // Fill in the UnrollingPreferences parameter with values from the
>
> Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=247263&r1=247262&r2=247263&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Sep 10 05:22:12
> 2015
> @@ -30,6 +30,7 @@
> #include "llvm/ADT/STLExtras.h"
> #include "llvm/ADT/SmallPtrSet.h"
> #include "llvm/ADT/Statistic.h"
> +#include "llvm/Analysis/GlobalsModRef.h"
> #include "llvm/Analysis/AssumptionCache.h"
> #include "llvm/Analysis/CodeMetrics.h"
> #include "llvm/Analysis/InstructionSimplify.h"
> @@ -195,6 +196,7 @@ namespace {
> AU.addPreserved<DominatorTreeWrapperPass>();
> AU.addPreserved<ScalarEvolutionWrapperPass>();
> AU.addRequired<TargetTransformInfoWrapperPass>();
> + AU.addPreserved<GlobalsAAWrapperPass>();
> }
>
> private:
>
> Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=247263&r1=247262&r2=247263&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Thu Sep 10 05:22:12
> 2015
> @@ -26,6 +26,7 @@
> #include "llvm/ADT/STLExtras.h"
> #include "llvm/ADT/SetVector.h"
> #include "llvm/ADT/Statistic.h"
> +#include "llvm/Analysis/GlobalsModRef.h"
> #include "llvm/Analysis/ValueTracking.h"
> #include "llvm/IR/CFG.h"
> #include "llvm/IR/Constants.h"
> @@ -173,6 +174,7 @@ namespace {
>
> void getAnalysisUsage(AnalysisUsage &AU) const override {
> AU.setPreservesCFG();
> + AU.addPreserved<GlobalsAAWrapperPass>();
> }
> private:
> void BuildRankMap(Function &F);
>
> Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=247263&r1=247262&r2=247263&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Thu Sep 10 05:22:12 2015
> @@ -24,6 +24,7 @@
> #include "llvm/ADT/SmallPtrSet.h"
> #include "llvm/ADT/SmallVector.h"
> #include "llvm/ADT/Statistic.h"
> +#include "llvm/Analysis/GlobalsModRef.h"
> #include "llvm/Analysis/ConstantFolding.h"
> #include "llvm/Analysis/TargetLibraryInfo.h"
> #include "llvm/IR/CallSite.h"
> @@ -1511,6 +1512,7 @@ namespace {
> struct SCCP : public FunctionPass {
> void getAnalysisUsage(AnalysisUsage &AU) const override {
> AU.addRequired<TargetLibraryInfoWrapperPass>();
> + AU.addPreserved<GlobalsAAWrapperPass>();
> }
> static char ID; // Pass identification, replacement for typeid
> SCCP() : FunctionPass(ID) {
>
> Modified: llvm/trunk/lib/Transforms/Scalar/SROA.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=247263&r1=247262&r2=247263&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Thu Sep 10 05:22:12 2015
> @@ -28,6 +28,7 @@
> #include "llvm/ADT/SetVector.h"
> #include "llvm/ADT/SmallVector.h"
> #include "llvm/ADT/Statistic.h"
> +#include "llvm/Analysis/GlobalsModRef.h"
> #include "llvm/Analysis/AssumptionCache.h"
> #include "llvm/Analysis/Loads.h"
> #include "llvm/Analysis/PtrUseVisitor.h"
> @@ -4355,5 +4356,6 @@ bool SROA::runOnFunction(Function &F) {
> void SROA::getAnalysisUsage(AnalysisUsage &AU) const {
> AU.addRequired<AssumptionCacheTracker>();
> AU.addRequired<DominatorTreeWrapperPass>();
> + AU.addPreserved<GlobalsAAWrapperPass>();
> AU.setPreservesCFG();
> }
>
> Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp?rev=247263&r1=247262&r2=247263&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp Thu Sep 10
> 05:22:12 2015
> @@ -25,6 +25,7 @@
> #include "llvm/ADT/SmallPtrSet.h"
> #include "llvm/ADT/SmallVector.h"
> #include "llvm/ADT/Statistic.h"
> +#include "llvm/Analysis/GlobalsModRef.h"
> #include "llvm/Analysis/AssumptionCache.h"
> #include "llvm/Analysis/TargetTransformInfo.h"
> #include "llvm/IR/Attributes.h"
> @@ -217,6 +218,7 @@ struct CFGSimplifyPass : public Function
> void getAnalysisUsage(AnalysisUsage &AU) const override {
> AU.addRequired<AssumptionCacheTracker>();
> AU.addRequired<TargetTransformInfoWrapperPass>();
> + AU.addPreserved<GlobalsAAWrapperPass>();
> }
> };
> }
>
> Modified: llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp?rev=247263&r1=247262&r2=247263&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp
> (original)
> +++ llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp Thu Sep
> 10 05:22:12 2015
> @@ -54,6 +54,7 @@
> #include "llvm/ADT/STLExtras.h"
> #include "llvm/ADT/SmallPtrSet.h"
> #include "llvm/ADT/Statistic.h"
> +#include "llvm/Analysis/GlobalsModRef.h"
> #include "llvm/Analysis/CFG.h"
> #include "llvm/Analysis/CaptureTracking.h"
> #include "llvm/Analysis/InlineCost.h"
> @@ -136,6 +137,7 @@ FunctionPass *llvm::createTailCallElimin
>
> void TailCallElim::getAnalysisUsage(AnalysisUsage &AU) const {
> AU.addRequired<TargetTransformInfoWrapperPass>();
> + AU.addPreserved<GlobalsAAWrapperPass>();
> }
>
> /// \brief Scan the specified function for alloca instructions.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150910/ce7fa5ab/attachment.html>
More information about the llvm-commits
mailing list