@@ -975,12 +975,11 @@ static RTLIB::Libcall fremToLibcall(Type *Ty) {
975975/* Return true if, according to \p LibInfo, the target either directly
976976 supports the frem instruction for the \p Ty, has a custom lowering,
977977 or uses a libcall. */
978- static bool targetSupportsFrem (const TargetLowering &TLI,
979- const LibcallLoweringInfo &Libcalls, Type *Ty) {
978+ static bool targetSupportsFrem (const TargetLowering &TLI, Type *Ty) {
980979 if (!TLI.isOperationExpand (ISD::FREM, EVT::getEVT (Ty)))
981980 return true ;
982981
983- return Libcalls .getLibcallName (fremToLibcall (Ty->getScalarType ()));
982+ return TLI .getLibcallName (fremToLibcall (Ty->getScalarType ()));
984983}
985984
986985static void addToWorklist (Instruction &I,
@@ -992,7 +991,7 @@ static void addToWorklist(Instruction &I,
992991}
993992
994993static bool runImpl (Function &F, const TargetLowering &TLI,
995- const LibcallLoweringInfo &Libcalls, AssumptionCache *AC) {
994+ AssumptionCache *AC) {
996995 SmallVector<Instruction *, 4 > Worklist;
997996
998997 unsigned MaxLegalFpConvertBitWidth =
@@ -1011,7 +1010,7 @@ static bool runImpl(Function &F, const TargetLowering &TLI,
10111010
10121011 switch (I.getOpcode ()) {
10131012 case Instruction::FRem:
1014- return !targetSupportsFrem (TLI, Libcalls, Ty) &&
1013+ return !targetSupportsFrem (TLI, Ty) &&
10151014 FRemExpander::canExpandType (Ty->getScalarType ());
10161015
10171016 case Instruction::FPToUI:
@@ -1091,27 +1090,20 @@ class ExpandFpLegacyPass : public FunctionPass {
10911090
10921091 bool runOnFunction (Function &F) override {
10931092 auto *TM = &getAnalysis<TargetPassConfig>().getTM <TargetMachine>();
1094- const TargetSubtargetInfo *Subtarget = TM->getSubtargetImpl (F);
1095- auto *TLI = Subtarget->getTargetLowering ();
1093+ auto *TLI = TM->getSubtargetImpl (F)->getTargetLowering ();
10961094 AssumptionCache *AC = nullptr ;
10971095
1098- const LibcallLoweringInfo &Libcalls =
1099- getAnalysis<LibcallLoweringInfoWrapper>().getLibcallLowering (
1100- *Subtarget);
1101-
11021096 if (OptLevel != CodeGenOptLevel::None && !F.hasOptNone ())
11031097 AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache (F);
1104- return runImpl (F, *TLI, Libcalls, AC);
1098+ return runImpl (F, *TLI, AC);
11051099 }
11061100
11071101 void getAnalysisUsage (AnalysisUsage &AU) const override {
1108- AU.addRequired <LibcallLoweringInfoWrapper>();
11091102 AU.addRequired <TargetPassConfig>();
11101103 if (OptLevel != CodeGenOptLevel::None)
11111104 AU.addRequired <AssumptionCacheTracker>();
11121105 AU.addPreserved <AAResultsWrapperPass>();
11131106 AU.addPreserved <GlobalsAAWrapperPass>();
1114- AU.addRequired <LibcallLoweringInfoWrapper>();
11151107 }
11161108};
11171109} // namespace
@@ -1134,29 +1126,13 @@ PreservedAnalyses ExpandFpPass::run(Function &F, FunctionAnalysisManager &FAM) {
11341126 AssumptionCache *AC = nullptr ;
11351127 if (OptLevel != CodeGenOptLevel::None)
11361128 AC = &FAM.getResult <AssumptionAnalysis>(F);
1137-
1138- auto &MAMProxy = FAM.getResult <ModuleAnalysisManagerFunctionProxy>(F);
1139-
1140- const LibcallLoweringModuleAnalysisResult *LibcallLowering =
1141- MAMProxy.getCachedResult <LibcallLoweringModuleAnalysis>(*F.getParent ());
1142-
1143- if (!LibcallLowering) {
1144- F.getContext ().emitError (" '" + LibcallLoweringModuleAnalysis::name () +
1145- " ' analysis required" );
1146- return PreservedAnalyses::all ();
1147- }
1148-
1149- const LibcallLoweringInfo &Libcalls =
1150- LibcallLowering->getLibcallLowering (*STI);
1151-
1152- return runImpl (F, TLI, Libcalls, AC) ? PreservedAnalyses::none ()
1153- : PreservedAnalyses::all ();
1129+ return runImpl (F, TLI, AC) ? PreservedAnalyses::none ()
1130+ : PreservedAnalyses::all ();
11541131}
11551132
11561133char ExpandFpLegacyPass::ID = 0 ;
11571134INITIALIZE_PASS_BEGIN (ExpandFpLegacyPass, " expand-fp" ,
11581135 " Expand certain fp instructions" , false , false )
1159- INITIALIZE_PASS_DEPENDENCY(LibcallLoweringInfoWrapper)
11601136INITIALIZE_PASS_END(ExpandFpLegacyPass, " expand-fp" , " Expand fp" , false , false )
11611137
11621138FunctionPass *llvm::createExpandFpPass(CodeGenOptLevel OptLevel) {
0 commit comments