[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

Serge Pavlov via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 5 22:08:27 PST 2024


================
@@ -273,29 +306,6 @@ void InstrProfCallsite::setCallee(Value *Callee) {
   setArgOperand(4, Callee);
 }
 
-std::optional<RoundingMode> ConstrainedFPIntrinsic::getRoundingMode() const {
-  unsigned NumOperands = arg_size();
-  Metadata *MD = nullptr;
-  auto *MAV = dyn_cast<MetadataAsValue>(getArgOperand(NumOperands - 2));
-  if (MAV)
-    MD = MAV->getMetadata();
-  if (!MD || !isa<MDString>(MD))
-    return std::nullopt;
-  return convertStrToRoundingMode(cast<MDString>(MD)->getString());
-}
-
-std::optional<fp::ExceptionBehavior>
-ConstrainedFPIntrinsic::getExceptionBehavior() const {
-  unsigned NumOperands = arg_size();
-  Metadata *MD = nullptr;
-  auto *MAV = dyn_cast<MetadataAsValue>(getArgOperand(NumOperands - 1));
-  if (MAV)
-    MD = MAV->getMetadata();
-  if (!MD || !isa<MDString>(MD))
-    return std::nullopt;
-  return convertStrToExceptionBehavior(cast<MDString>(MD)->getString());
-}
-
----------------
spavloff wrote:

You are right. Now methods `getRoundingMode` and `getExceptionBehavior` are implemented in `CallBase` and use the information in bundles. Methods from `ConstrainedFPIntrinsic` are turned into functions `getRoundingModeArg` and `getExceptionBehaviorArg`, they are needed in autoupgrade.

https://github.com/llvm/llvm-project/pull/109798


More information about the cfe-commits mailing list