@@ -1224,7 +1224,7 @@ static bool upgradeIntrinsicFunction1(Function *F, Function *&NewFn,
12241224 assert (Success && " cannot get intrinsic signature" );
12251225
12261226 NewFn = Intrinsic::getOrInsertDeclaration (F->getParent (), NewID,
1227- OverloadTys);
1227+ OverloadTys);
12281228 }
12291229 return true ;
12301230 }
@@ -4953,44 +4953,43 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
49534953 MTI->setSourceAlignment (Align->getMaybeAlignValue ());
49544954 break ;
49554955 }
4956- #define LEGACY_FUNCTION (NAME, A, R, I, D ) \
4957- case Intrinsic::NAME:
4956+ #define LEGACY_FUNCTION (NAME, A, R, I, D ) case Intrinsic::NAME:
49584957#include " llvm/IR/ConstrainedOps.def"
4959- {
4960- SmallVector<OperandBundleDef, 2 > Bundles;
4961- unsigned NumMetadataArgs = 0 ;
4958+ {
4959+ SmallVector<OperandBundleDef, 2 > Bundles;
4960+ unsigned NumMetadataArgs = 0 ;
4961+
4962+ if (auto RM = getRoundingModeArg (*CI)) {
4963+ auto CurrentRM = CI->getRoundingMode ();
4964+ assert (!CurrentRM && " unexpected rounding bundle" );
4965+ Builder.createFPRoundingBundle (Bundles, RM);
4966+ ++NumMetadataArgs;
4967+ }
49624968
4963- if (auto RM = getRoundingModeArg (*CI)) {
4964- auto CurrentRM = CI->getRoundingMode ();
4965- assert (!CurrentRM && " unexpected rounding bundle" );
4966- Builder.createFPRoundingBundle (Bundles, RM );
4967- ++NumMetadataArgs;
4968- }
4969+ if (auto EB = getExceptionBehaviorArg (*CI)) {
4970+ auto CurrentEB = CI->getExceptionBehavior ();
4971+ assert (!CurrentEB && " unexpected exception bundle" );
4972+ Builder.createFPExceptionBundle (Bundles, EB );
4973+ ++NumMetadataArgs;
4974+ }
49694975
4970- if (auto EB = getExceptionBehaviorArg (*CI)) {
4971- auto CurrentEB = CI->getExceptionBehavior ();
4972- assert (!CurrentEB && " unexpected exception bundle" );
4973- Builder.createFPExceptionBundle (Bundles, EB);
4974- ++NumMetadataArgs;
4975- }
4976+ SmallVector<Value *, 4 > Args (CI->args ());
4977+ Args.pop_back_n (NumMetadataArgs);
4978+ NewCall = Builder.CreateCall (NewFn, Args, Bundles, CI->getName ());
4979+ NewCall->copyMetadata (*CI);
4980+ AttributeList Attrs = CI->getAttributes ();
4981+ NewCall->setAttributes (Attrs);
4982+ if (isa<FPMathOperator>(CI)) {
4983+ FastMathFlags FMF = CI->getFastMathFlags ();
4984+ NewCall->setFastMathFlags (FMF);
4985+ }
49764986
4977- SmallVector<Value *, 4 > Args (CI->args ());
4978- Args.pop_back_n (NumMetadataArgs);
4979- NewCall = Builder.CreateCall (NewFn, Args, Bundles, CI->getName ());
4980- NewCall->copyMetadata (*CI);
4981- AttributeList Attrs = CI->getAttributes ();
4982- NewCall->setAttributes (Attrs);
4983- if (isa<FPMathOperator>(CI)) {
4984- FastMathFlags FMF = CI->getFastMathFlags ();
4985- NewCall->setFastMathFlags (FMF);
4987+ MemoryEffects ME = MemoryEffects::inaccessibleMemOnly ();
4988+ auto A = Attribute::getWithMemoryEffects (CI->getContext (), ME);
4989+ NewCall->addFnAttr (A);
4990+ NewCall->addFnAttr (Attribute::StrictFP);
4991+ break ;
49864992 }
4987-
4988- MemoryEffects ME = MemoryEffects::inaccessibleMemOnly ();
4989- auto A = Attribute::getWithMemoryEffects (CI->getContext (), ME);
4990- NewCall->addFnAttr (A);
4991- NewCall->addFnAttr (Attribute::StrictFP);
4992- break ;
4993- }
49944993 }
49954994 assert (NewCall && " Should have either set this variable or returned through "
49964995 " the default case" );
0 commit comments