@@ -1215,7 +1215,7 @@ static bool upgradeIntrinsicFunction1(Function *F, Function *&NewFn,
12151215 assert (Success && " cannot get intrinsic signature" );
12161216
12171217 NewFn = Intrinsic::getOrInsertDeclaration (F->getParent (), NewID,
1218- OverloadTys);
1218+ OverloadTys);
12191219 }
12201220 return true ;
12211221 }
@@ -4956,44 +4956,43 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
49564956 MTI->setSourceAlignment (Align->getMaybeAlignValue ());
49574957 break ;
49584958 }
4959- #define LEGACY_FUNCTION (NAME, A, R, I, D ) \
4960- case Intrinsic::NAME:
4959+ #define LEGACY_FUNCTION (NAME, A, R, I, D ) case Intrinsic::NAME:
49614960#include " llvm/IR/ConstrainedOps.def"
4962- {
4963- SmallVector<OperandBundleDef, 2 > Bundles;
4964- unsigned NumMetadataArgs = 0 ;
4961+ {
4962+ SmallVector<OperandBundleDef, 2 > Bundles;
4963+ unsigned NumMetadataArgs = 0 ;
4964+
4965+ if (auto RM = getRoundingModeArg (*CI)) {
4966+ auto CurrentRM = CI->getRoundingMode ();
4967+ assert (!CurrentRM && " unexpected rounding bundle" );
4968+ Builder.createFPRoundingBundle (Bundles, RM);
4969+ ++NumMetadataArgs;
4970+ }
49654971
4966- if (auto RM = getRoundingModeArg (*CI)) {
4967- auto CurrentRM = CI->getRoundingMode ();
4968- assert (!CurrentRM && " unexpected rounding bundle" );
4969- Builder.createFPRoundingBundle (Bundles, RM );
4970- ++NumMetadataArgs;
4971- }
4972+ if (auto EB = getExceptionBehaviorArg (*CI)) {
4973+ auto CurrentEB = CI->getExceptionBehavior ();
4974+ assert (!CurrentEB && " unexpected exception bundle" );
4975+ Builder.createFPExceptionBundle (Bundles, EB );
4976+ ++NumMetadataArgs;
4977+ }
49724978
4973- if (auto EB = getExceptionBehaviorArg (*CI)) {
4974- auto CurrentEB = CI->getExceptionBehavior ();
4975- assert (!CurrentEB && " unexpected exception bundle" );
4976- Builder.createFPExceptionBundle (Bundles, EB);
4977- ++NumMetadataArgs;
4978- }
4979+ SmallVector<Value *, 4 > Args (CI->args ());
4980+ Args.pop_back_n (NumMetadataArgs);
4981+ NewCall = Builder.CreateCall (NewFn, Args, Bundles, CI->getName ());
4982+ NewCall->copyMetadata (*CI);
4983+ AttributeList Attrs = CI->getAttributes ();
4984+ NewCall->setAttributes (Attrs);
4985+ if (isa<FPMathOperator>(CI)) {
4986+ FastMathFlags FMF = CI->getFastMathFlags ();
4987+ NewCall->setFastMathFlags (FMF);
4988+ }
49794989
4980- SmallVector<Value *, 4 > Args (CI->args ());
4981- Args.pop_back_n (NumMetadataArgs);
4982- NewCall = Builder.CreateCall (NewFn, Args, Bundles, CI->getName ());
4983- NewCall->copyMetadata (*CI);
4984- AttributeList Attrs = CI->getAttributes ();
4985- NewCall->setAttributes (Attrs);
4986- if (isa<FPMathOperator>(CI)) {
4987- FastMathFlags FMF = CI->getFastMathFlags ();
4988- NewCall->setFastMathFlags (FMF);
4990+ MemoryEffects ME = MemoryEffects::inaccessibleMemOnly ();
4991+ auto A = Attribute::getWithMemoryEffects (CI->getContext (), ME);
4992+ NewCall->addFnAttr (A);
4993+ NewCall->addFnAttr (Attribute::StrictFP);
4994+ break ;
49894995 }
4990-
4991- MemoryEffects ME = MemoryEffects::inaccessibleMemOnly ();
4992- auto A = Attribute::getWithMemoryEffects (CI->getContext (), ME);
4993- NewCall->addFnAttr (A);
4994- NewCall->addFnAttr (Attribute::StrictFP);
4995- break ;
4996- }
49974996 }
49984997 assert (NewCall && " Should have either set this variable or returned through "
49994998 " the default case" );
0 commit comments