================ @@ -4282,6 +4282,64 @@ static void upgradeDbgIntrinsicToDbgRecord(StringRef Name, CallBase *CI) { CI->getParent()->insertDbgRecordBefore(DR, CI->getIterator()); } +static CallBase *upgradeConstrainedIntrinsicCall(CallBase *CB, Function *F, + IRBuilder<> &Builder) { + if (CB->getOperandBundle(LLVMContext::OB_fpe_round)) + return nullptr; + + auto *CFPI = cast<ConstrainedFPIntrinsic>(F); + SmallVector<OperandBundleDef, 2> NewBundles; + LLVMContext &C = CB->getContext(); + + auto RM = CFPI->getRoundingMode(); + if (RM) { + auto CurrentRM = CB->getRoundingMode(); + if (CurrentRM) { + assert(*RM == *CurrentRM); + } else { + int RMValue = static_cast<int>(*RM); + NewBundles.emplace_back("fpe.round", + ConstantInt::get(Type::getInt32Ty(C), RMValue)); + } + } + + auto EB = CFPI->getExceptionBehavior(); + if (EB) { + auto CurrentEB = CB->getExceptionBehavior(); + if (CurrentEB) { + assert(*EB == *CurrentEB); + } else { + NewBundles.emplace_back("fpe.except", + ConstantInt::get(Type::getInt32Ty(C), *EB)); ---------------- spavloff wrote:
Probably. But if a function is used in strictfp environment, it must have a side effect for proper ordering. Keeping explicit bundles could assist this. https://github.com/llvm/llvm-project/pull/109798 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits