@@ -2524,37 +2524,37 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
25242524 if (IntrinsicID == Intrinsic::nearbyint || IntrinsicID == Intrinsic::rint ||
25252525 IntrinsicID == Intrinsic::roundeven) {
25262526 U.roundToIntegral (APFloat::rmNearestTiesToEven);
2527- return ConstantFP::get (Ty-> getContext () , U);
2527+ return ConstantFP::get (Ty, U);
25282528 }
25292529
25302530 if (IntrinsicID == Intrinsic::round) {
25312531 U.roundToIntegral (APFloat::rmNearestTiesToAway);
2532- return ConstantFP::get (Ty-> getContext () , U);
2532+ return ConstantFP::get (Ty, U);
25332533 }
25342534
25352535 if (IntrinsicID == Intrinsic::roundeven) {
25362536 U.roundToIntegral (APFloat::rmNearestTiesToEven);
2537- return ConstantFP::get (Ty-> getContext () , U);
2537+ return ConstantFP::get (Ty, U);
25382538 }
25392539
25402540 if (IntrinsicID == Intrinsic::ceil) {
25412541 U.roundToIntegral (APFloat::rmTowardPositive);
2542- return ConstantFP::get (Ty-> getContext () , U);
2542+ return ConstantFP::get (Ty, U);
25432543 }
25442544
25452545 if (IntrinsicID == Intrinsic::floor) {
25462546 U.roundToIntegral (APFloat::rmTowardNegative);
2547- return ConstantFP::get (Ty-> getContext () , U);
2547+ return ConstantFP::get (Ty, U);
25482548 }
25492549
25502550 if (IntrinsicID == Intrinsic::trunc) {
25512551 U.roundToIntegral (APFloat::rmTowardZero);
2552- return ConstantFP::get (Ty-> getContext () , U);
2552+ return ConstantFP::get (Ty, U);
25532553 }
25542554
25552555 if (IntrinsicID == Intrinsic::fabs) {
25562556 U.clearSign ();
2557- return ConstantFP::get (Ty-> getContext () , U);
2557+ return ConstantFP::get (Ty, U);
25582558 }
25592559
25602560 if (IntrinsicID == Intrinsic::amdgcn_fract) {
@@ -2567,7 +2567,7 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
25672567 APFloat FractU (U - FloorU);
25682568 APFloat AlmostOne (U.getSemantics (), 1 );
25692569 AlmostOne.next (/* nextDown*/ true );
2570- return ConstantFP::get (Ty-> getContext () , minimum (FractU, AlmostOne));
2570+ return ConstantFP::get (Ty, minimum (FractU, AlmostOne));
25712571 }
25722572
25732573 // Rounding operations (floor, trunc, ceil, round and nearbyint) do not
@@ -2614,7 +2614,7 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
26142614 return nullptr ;
26152615 U = APFloat::getQNaN (U.getSemantics ());
26162616 }
2617- return ConstantFP::get (Ty-> getContext () , U);
2617+ return ConstantFP::get (Ty, U);
26182618 }
26192619
26202620 // NVVM float/double to signed/unsigned int32/int64 conversions:
@@ -2745,7 +2745,7 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
27452745 case Intrinsic::atan:
27462746 // Implement optional behavior from C's Annex F for +/-0.0.
27472747 if (U.isZero ())
2748- return ConstantFP::get (Ty-> getContext () , U);
2748+ return ConstantFP::get (Ty, U);
27492749 return ConstantFoldFP (atan, APF, Ty);
27502750 case Intrinsic::sqrt:
27512751 return ConstantFoldFP (sqrt, APF, Ty);
@@ -2796,7 +2796,7 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
27962796 if (Status == APFloat::opOK || Status == APFloat::opInexact) {
27972797 if (IsFTZ)
27982798 Res = FTZPreserveSign (Res);
2799- return ConstantFP::get (Ty-> getContext () , Res);
2799+ return ConstantFP::get (Ty, Res);
28002800 }
28012801 return nullptr ;
28022802 }
@@ -2810,7 +2810,7 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
28102810 bool IsFTZ = nvvm::UnaryMathIntrinsicShouldFTZ (IntrinsicID);
28112811 auto V = IsFTZ ? FTZPreserveSign (APF) : APF;
28122812 V.roundToIntegral (APFloat::rmNearestTiesToEven);
2813- return ConstantFP::get (Ty-> getContext () , V);
2813+ return ConstantFP::get (Ty, V);
28142814 }
28152815
28162816 case Intrinsic::nvvm_saturate_ftz_f:
@@ -2822,8 +2822,8 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
28222822 return ConstantFP::getZero (Ty);
28232823 APFloat One = APFloat::getOne (APF.getSemantics ());
28242824 if (V > One)
2825- return ConstantFP::get (Ty-> getContext () , One);
2826- return ConstantFP::get (Ty-> getContext () , APF);
2825+ return ConstantFP::get (Ty, One);
2826+ return ConstantFP::get (Ty, APF);
28272827 }
28282828
28292829 case Intrinsic::nvvm_sqrt_rn_ftz_f:
@@ -2890,15 +2890,15 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
28902890 case LibFunc_atanf:
28912891 // Implement optional behavior from C's Annex F for +/-0.0.
28922892 if (U.isZero ())
2893- return ConstantFP::get (Ty-> getContext () , U);
2893+ return ConstantFP::get (Ty, U);
28942894 if (TLI->has (Func))
28952895 return ConstantFoldFP (atan, APF, Ty);
28962896 break ;
28972897 case LibFunc_ceil:
28982898 case LibFunc_ceilf:
28992899 if (TLI->has (Func)) {
29002900 U.roundToIntegral (APFloat::rmTowardPositive);
2901- return ConstantFP::get (Ty-> getContext () , U);
2901+ return ConstantFP::get (Ty, U);
29022902 }
29032903 break ;
29042904 case LibFunc_cos:
@@ -2932,14 +2932,14 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
29322932 case LibFunc_fabsf:
29332933 if (TLI->has (Func)) {
29342934 U.clearSign ();
2935- return ConstantFP::get (Ty-> getContext () , U);
2935+ return ConstantFP::get (Ty, U);
29362936 }
29372937 break ;
29382938 case LibFunc_floor:
29392939 case LibFunc_floorf:
29402940 if (TLI->has (Func)) {
29412941 U.roundToIntegral (APFloat::rmTowardNegative);
2942- return ConstantFP::get (Ty-> getContext () , U);
2942+ return ConstantFP::get (Ty, U);
29432943 }
29442944 break ;
29452945 case LibFunc_log:
@@ -2979,7 +2979,7 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
29792979 case LibFunc_log1pf:
29802980 // Implement optional behavior from C's Annex F for +/-0.0.
29812981 if (U.isZero ())
2982- return ConstantFP::get (Ty-> getContext () , U);
2982+ return ConstantFP::get (Ty, U);
29832983 if (APF > APFloat::getOne (APF.getSemantics (), true ) && TLI->has (Func))
29842984 return ConstantFoldFP (log1p, APF, Ty);
29852985 break ;
@@ -2998,14 +2998,14 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
29982998 case LibFunc_roundevenf:
29992999 if (TLI->has (Func)) {
30003000 U.roundToIntegral (APFloat::rmNearestTiesToEven);
3001- return ConstantFP::get (Ty-> getContext () , U);
3001+ return ConstantFP::get (Ty, U);
30023002 }
30033003 break ;
30043004 case LibFunc_round:
30053005 case LibFunc_roundf:
30063006 if (TLI->has (Func)) {
30073007 U.roundToIntegral (APFloat::rmNearestTiesToAway);
3008- return ConstantFP::get (Ty-> getContext () , U);
3008+ return ConstantFP::get (Ty, U);
30093009 }
30103010 break ;
30113011 case LibFunc_sin:
@@ -3039,7 +3039,7 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
30393039 case LibFunc_truncf:
30403040 if (TLI->has (Func)) {
30413041 U.roundToIntegral (APFloat::rmTowardZero);
3042- return ConstantFP::get (Ty-> getContext () , U);
3042+ return ConstantFP::get (Ty, U);
30433043 }
30443044 break ;
30453045 }
@@ -3066,7 +3066,7 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
30663066 assert (status != APFloat::opInexact && !lost &&
30673067 " Precision lost during fp16 constfolding" );
30683068
3069- return ConstantFP::get (Ty-> getContext () , Val);
3069+ return ConstantFP::get (Ty, Val);
30703070 }
30713071
30723072 case Intrinsic::amdgcn_s_wqm: {
@@ -3218,15 +3218,15 @@ static Constant *ConstantFoldLibCall2(StringRef Name, Type *Ty,
32183218 if (TLI->has (Func)) {
32193219 APFloat V = Op1->getValueAPF ();
32203220 if (APFloat::opStatus::opOK == V.mod (Op2->getValueAPF ()))
3221- return ConstantFP::get (Ty-> getContext () , V);
3221+ return ConstantFP::get (Ty, V);
32223222 }
32233223 break ;
32243224 case LibFunc_remainder:
32253225 case LibFunc_remainderf:
32263226 if (TLI->has (Func)) {
32273227 APFloat V = Op1->getValueAPF ();
32283228 if (APFloat::opStatus::opOK == V.remainder (Op2->getValueAPF ()))
3229- return ConstantFP::get (Ty-> getContext () , V);
3229+ return ConstantFP::get (Ty, V);
32303230 }
32313231 break ;
32323232 case LibFunc_atan2:
@@ -3346,31 +3346,31 @@ static Constant *ConstantFoldIntrinsicCall2(Intrinsic::ID IntrinsicID, Type *Ty,
33463346 }
33473347 if (mayFoldConstrained (const_cast <ConstrainedFPIntrinsic *>(ConstrIntr),
33483348 St))
3349- return ConstantFP::get (Ty-> getContext () , Res);
3349+ return ConstantFP::get (Ty, Res);
33503350 return nullptr ;
33513351 }
33523352
33533353 switch (IntrinsicID) {
33543354 default :
33553355 break ;
33563356 case Intrinsic::copysign:
3357- return ConstantFP::get (Ty-> getContext () , APFloat::copySign (Op1V, Op2V));
3357+ return ConstantFP::get (Ty, APFloat::copySign (Op1V, Op2V));
33583358 case Intrinsic::minnum:
33593359 if (Op1V.isSignaling () || Op2V.isSignaling ())
33603360 return nullptr ;
3361- return ConstantFP::get (Ty-> getContext () , minnum (Op1V, Op2V));
3361+ return ConstantFP::get (Ty, minnum (Op1V, Op2V));
33623362 case Intrinsic::maxnum:
33633363 if (Op1V.isSignaling () || Op2V.isSignaling ())
33643364 return nullptr ;
3365- return ConstantFP::get (Ty-> getContext () , maxnum (Op1V, Op2V));
3365+ return ConstantFP::get (Ty, maxnum (Op1V, Op2V));
33663366 case Intrinsic::minimum:
3367- return ConstantFP::get (Ty-> getContext () , minimum (Op1V, Op2V));
3367+ return ConstantFP::get (Ty, minimum (Op1V, Op2V));
33683368 case Intrinsic::maximum:
3369- return ConstantFP::get (Ty-> getContext () , maximum (Op1V, Op2V));
3369+ return ConstantFP::get (Ty, maximum (Op1V, Op2V));
33703370 case Intrinsic::minimumnum:
3371- return ConstantFP::get (Ty-> getContext () , minimumnum (Op1V, Op2V));
3371+ return ConstantFP::get (Ty, minimumnum (Op1V, Op2V));
33723372 case Intrinsic::maximumnum:
3373- return ConstantFP::get (Ty-> getContext () , maximumnum (Op1V, Op2V));
3373+ return ConstantFP::get (Ty, maximumnum (Op1V, Op2V));
33743374
33753375 case Intrinsic::nvvm_fmax_d:
33763376 case Intrinsic::nvvm_fmax_f:
@@ -3442,7 +3442,7 @@ static Constant *ConstantFoldIntrinsicCall2(Intrinsic::ID IntrinsicID, Type *Ty,
34423442 if (IsXorSignAbs && XorSign != Res.isNegative ())
34433443 Res.changeSign ();
34443444
3445- return ConstantFP::get (Ty-> getContext () , Res);
3445+ return ConstantFP::get (Ty, Res);
34463446 }
34473447
34483448 case Intrinsic::nvvm_add_rm_f:
@@ -3471,7 +3471,7 @@ static Constant *ConstantFoldIntrinsicCall2(Intrinsic::ID IntrinsicID, Type *Ty,
34713471 if (!Res.isNaN () &&
34723472 (Status == APFloat::opOK || Status == APFloat::opInexact)) {
34733473 Res = IsFTZ ? FTZPreserveSign (Res) : Res;
3474- return ConstantFP::get (Ty-> getContext () , Res);
3474+ return ConstantFP::get (Ty, Res);
34753475 }
34763476 return nullptr ;
34773477 }
@@ -3502,7 +3502,7 @@ static Constant *ConstantFoldIntrinsicCall2(Intrinsic::ID IntrinsicID, Type *Ty,
35023502 if (!Res.isNaN () &&
35033503 (Status == APFloat::opOK || Status == APFloat::opInexact)) {
35043504 Res = IsFTZ ? FTZPreserveSign (Res) : Res;
3505- return ConstantFP::get (Ty-> getContext () , Res);
3505+ return ConstantFP::get (Ty, Res);
35063506 }
35073507 return nullptr ;
35083508 }
@@ -3530,7 +3530,7 @@ static Constant *ConstantFoldIntrinsicCall2(Intrinsic::ID IntrinsicID, Type *Ty,
35303530 if (!Res.isNaN () &&
35313531 (Status == APFloat::opOK || Status == APFloat::opInexact)) {
35323532 Res = IsFTZ ? FTZPreserveSign (Res) : Res;
3533- return ConstantFP::get (Ty-> getContext () , Res);
3533+ return ConstantFP::get (Ty, Res);
35343534 }
35353535 return nullptr ;
35363536 }
@@ -3549,7 +3549,7 @@ static Constant *ConstantFoldIntrinsicCall2(Intrinsic::ID IntrinsicID, Type *Ty,
35493549 // NaN or infinity, gives +0.0.
35503550 if (Op1V.isZero () || Op2V.isZero ())
35513551 return ConstantFP::getZero (Ty);
3552- return ConstantFP::get (Ty-> getContext () , Op1V * Op2V);
3552+ return ConstantFP::get (Ty, Op1V * Op2V);
35533553 }
35543554
35553555 } else if (auto *Op2C = dyn_cast<ConstantInt>(Operands[1 ])) {
@@ -3585,7 +3585,7 @@ static Constant *ConstantFoldIntrinsicCall2(Intrinsic::ID IntrinsicID, Type *Ty,
35853585 Res.convert (APFloat::IEEEhalf (), APFloat::rmNearestTiesToEven,
35863586 &Unused);
35873587 }
3588- return ConstantFP::get (Ty-> getContext () , Res);
3588+ return ConstantFP::get (Ty, Res);
35893589 }
35903590 case Type::DoubleTyID:
35913591 return ConstantFP::get (Ty, std::pow (Op1V.convertToDouble (), Exp));
@@ -3930,7 +3930,7 @@ static Constant *ConstantFoldScalarCall3(StringRef Name,
39303930 }
39313931 if (mayFoldConstrained (
39323932 const_cast <ConstrainedFPIntrinsic *>(ConstrIntr), St))
3933- return ConstantFP::get (Ty-> getContext () , Res);
3933+ return ConstantFP::get (Ty, Res);
39343934 return nullptr ;
39353935 }
39363936
@@ -3942,15 +3942,15 @@ static Constant *ConstantFoldScalarCall3(StringRef Name,
39423942 if (C1.isZero () || C2.isZero ()) {
39433943 // It's tempting to just return C3 here, but that would give the
39443944 // wrong result if C3 was -0.0.
3945- return ConstantFP::get (Ty-> getContext () , APFloat (0 .0f ) + C3);
3945+ return ConstantFP::get (Ty, APFloat (0 .0f ) + C3);
39463946 }
39473947 [[fallthrough]];
39483948 }
39493949 case Intrinsic::fma:
39503950 case Intrinsic::fmuladd: {
39513951 APFloat V = C1;
39523952 V.fusedMultiplyAdd (C2, C3, APFloat::rmNearestTiesToEven);
3953- return ConstantFP::get (Ty-> getContext () , V);
3953+ return ConstantFP::get (Ty, V);
39543954 }
39553955
39563956 case Intrinsic::nvvm_fma_rm_f:
@@ -3979,7 +3979,7 @@ static Constant *ConstantFoldScalarCall3(StringRef Name,
39793979 if (!Res.isNaN () &&
39803980 (Status == APFloat::opOK || Status == APFloat::opInexact)) {
39813981 Res = IsFTZ ? FTZPreserveSign (Res) : Res;
3982- return ConstantFP::get (Ty-> getContext () , Res);
3982+ return ConstantFP::get (Ty, Res);
39833983 }
39843984 return nullptr ;
39853985 }
@@ -3989,7 +3989,7 @@ static Constant *ConstantFoldScalarCall3(StringRef Name,
39893989 case Intrinsic::amdgcn_cubesc:
39903990 case Intrinsic::amdgcn_cubetc: {
39913991 APFloat V = ConstantFoldAMDGCNCubeIntrinsic (IntrinsicID, C1, C2, C3);
3992- return ConstantFP::get (Ty-> getContext () , V);
3992+ return ConstantFP::get (Ty, V);
39933993 }
39943994 }
39953995 }
0 commit comments