[llvm] e6cf796 - Preserve GlobalsAA analysis result in LowerConstantIntrinsics
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 2 07:44:10 PDT 2020
Author: Ryan Santhiraraja
Date: 2020-07-02T15:40:41+01:00
New Revision: e6cf796bab7e02d2b8ac7fd495f14f5e21494270
URL: https://github.com/llvm/llvm-project/commit/e6cf796bab7e02d2b8ac7fd495f14f5e21494270
DIFF: https://github.com/llvm/llvm-project/commit/e6cf796bab7e02d2b8ac7fd495f14f5e21494270.diff
LOG: Preserve GlobalsAA analysis result in LowerConstantIntrinsics
LowerConstantIntrinsics fails to preserve the analysis result of
GlobalsAA. Not preserving the analysis might affect benchmark
performance. This change fixes this issue.
Patch by Ryan Santhiraraja <rsanthir at quicinc.com>
Reviewers: fpetrogalli, joerg, fhahn
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D82342
Added:
Modified:
llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp
index f59280b60d8d..fddf28c281fc 100644
--- a/llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp
+++ b/llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp
@@ -15,6 +15,7 @@
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/Statistic.h"
+#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
@@ -136,8 +137,12 @@ static bool lowerConstantIntrinsics(Function &F, const TargetLibraryInfo *TLI) {
PreservedAnalyses
LowerConstantIntrinsicsPass::run(Function &F, FunctionAnalysisManager &AM) {
- if (lowerConstantIntrinsics(F, AM.getCachedResult<TargetLibraryAnalysis>(F)))
- return PreservedAnalyses::none();
+ if (lowerConstantIntrinsics(F,
+ AM.getCachedResult<TargetLibraryAnalysis>(F))) {
+ PreservedAnalyses PA;
+ PA.preserve<GlobalsAA>();
+ return PA;
+ }
return PreservedAnalyses::all();
}
@@ -160,6 +165,10 @@ class LowerConstantIntrinsics : public FunctionPass {
const TargetLibraryInfo *TLI = TLIP ? &TLIP->getTLI(F) : nullptr;
return lowerConstantIntrinsics(F, TLI);
}
+
+ void getAnalysisUsage(AnalysisUsage &AU) const override {
+ AU.addPreserved<GlobalsAAWrapperPass>();
+ }
};
} // namespace
More information about the llvm-commits
mailing list