forked from OSchip/llvm-project
[DCE] Always get TargetLibraryInfo
I don't see any reason not to unconditionally retrieve TLI, it's fairly cheap. Fixes calls-errno.ll under NPM. Reviewed By: asbirlea Differential Revision: https://reviews.llvm.org/D91476
This commit is contained in:
parent
9c09757bca
commit
ee7d315cd9
|
@ -143,7 +143,7 @@ static bool eliminateDeadCode(Function &F, TargetLibraryInfo *TLI) {
|
|||
}
|
||||
|
||||
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 @@ struct DCELegacyPass : public FunctionPass {
|
|||
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();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue