[llvm] [Attributor][FIX] Replace AANoFPClass MBEC propagation (PR #91030)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri May 3 23:44:29 PDT 2024
================
@@ -10332,47 +10332,26 @@ struct AANoFPClassImpl : AANoFPClass {
/// See followUsesInMBEC
bool followUseInMBEC(Attributor &A, const Use *U, const Instruction *I,
AANoFPClass::StateType &State) {
- const Value *UseV = U->get();
- const DominatorTree *DT = nullptr;
- AssumptionCache *AC = nullptr;
- const TargetLibraryInfo *TLI = nullptr;
- InformationCache &InfoCache = A.getInfoCache();
-
- if (Function *F = getAnchorScope()) {
- DT = InfoCache.getAnalysisResultForFunction<DominatorTreeAnalysis>(*F);
- AC = InfoCache.getAnalysisResultForFunction<AssumptionAnalysis>(*F);
- TLI = InfoCache.getTargetLibraryInfoForFunction(*F);
- }
-
- const DataLayout &DL = A.getDataLayout();
-
- KnownFPClass KnownFPClass =
- computeKnownFPClass(UseV, DL,
- /*InterestedClasses=*/fcAllFlags,
- /*Depth=*/0, TLI, AC, I, DT);
- State.addKnownBits(~KnownFPClass.KnownFPClasses);
-
- if (auto *CI = dyn_cast<CallInst>(UseV)) {
- // Special case FP intrinsic with struct return type.
- switch (CI->getIntrinsicID()) {
- case Intrinsic::frexp:
- return true;
- case Intrinsic::not_intrinsic:
- // TODO: Could recognize math libcalls
- return false;
- default:
- break;
- }
- }
+ // TODO: Determine what instructions can be looked through.
+ auto *CB = dyn_cast<CallBase>(I);
+ if (!CB)
+ return false;
- if (!UseV->getType()->isFPOrFPVectorTy())
+ if (!CB->isArgOperand(U))
return false;
- return !isa<LoadInst, AtomicRMWInst>(UseV);
+
+ unsigned ArgNo = CB->getArgOperandNo(U);
+ IRPosition IRP = IRPosition::callsite_argument(*CB, ArgNo);
+ if (auto *NoFPAA = A.getAAFor<AANoFPClass>(*this, IRP, DepClassTy::NONE))
+ State.addKnownBits(NoFPAA->getState().getKnown());
+ return false;
}
const std::string getAsStr(Attributor *A) const override {
std::string Result = "nofpclass";
raw_string_ostream OS(Result);
+ OS << getKnownNoFPClass();
+ OS << "/";
OS << getAssumedNoFPClass();
----------------
arsenm wrote:
```suggestion
OS << getKnownNoFPClass() << '/' << getAssumedNoFPClass();
```
https://github.com/llvm/llvm-project/pull/91030
More information about the llvm-commits
mailing list