[PATCH] D91476: [DCE] Always get TargetLibraryAnalysis
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 15 11:40:06 PST 2020
aeubanks updated this revision to Diff 305383.
aeubanks added a comment.
also change legacy pass
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91476/new/
https://reviews.llvm.org/D91476
Files:
llvm/lib/Transforms/Scalar/DCE.cpp
llvm/test/Transforms/DCE/calls-errno.ll
Index: llvm/test/Transforms/DCE/calls-errno.ll
===================================================================
--- llvm/test/Transforms/DCE/calls-errno.ll
+++ llvm/test/Transforms/DCE/calls-errno.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -dce -S | FileCheck %s
+; RUN: opt < %s -passes=dce -S | FileCheck %s
declare double @acos(double) nounwind
declare double @asin(double) nounwind
Index: llvm/lib/Transforms/Scalar/DCE.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/DCE.cpp
+++ llvm/lib/Transforms/Scalar/DCE.cpp
@@ -143,7 +143,7 @@
}
PreservedAnalyses DCEPass::run(Function &F, FunctionAnalysisManager &AM) {
- if (!eliminateDeadCode(F, AM.getCachedResult<TargetLibraryAnalysis>(F)))
+ if (!eliminateDeadCode(F, &AM.getResult<TargetLibraryAnalysis>(F)))
return PreservedAnalyses::all();
PreservedAnalyses PA;
@@ -162,13 +162,14 @@
if (skipFunction(F))
return false;
- auto *TLIP = getAnalysisIfAvailable<TargetLibraryInfoWrapperPass>();
- TargetLibraryInfo *TLI = TLIP ? &TLIP->getTLI(F) : nullptr;
+ TargetLibraryInfo *TLI =
+ &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F);
return eliminateDeadCode(F, TLI);
}
void getAnalysisUsage(AnalysisUsage &AU) const override {
+ AU.addRequired<TargetLibraryInfoWrapperPass>();
AU.setPreservesCFG();
}
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91476.305383.patch
Type: text/x-patch
Size: 1390 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201115/81387ebe/attachment.bin>
More information about the llvm-commits
mailing list