diff options
| author | Fangrui Song <i@maskray.me> | 2024-10-11 21:39:06 -0700 |
|---|---|---|
| committer | Amir Ayupov <aaupov@fb.com> | 2024-10-11 21:39:06 -0700 |
| commit | 436701d88c1384d3f72c44dd152cd55e47ef2de3 (patch) | |
| tree | c9825a370f1ba14e5fff19cea1279a0e7a7e9b54 /llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | |
| parent | efa1900174cb940f3750ce9e8cb6f06e69b4f3f0 (diff) | |
| parent | dd326b122506421aba2368053103767f4c56e2ba (diff) | |
[𝘀𝗽𝗿] changes introduced through rebaseusers/aaupov/spr/main.boltnfc-speedup-batwritemaps
Created using spr 1.3.4
[skip ci]
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index 9934c065ebf8..6c2554ea73b7 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -95,8 +95,8 @@ Value *InstCombinerImpl::EvaluateInDifferentType(Value *V, Type *Ty, default: llvm_unreachable("Unsupported call!"); case Intrinsic::vscale: { - Function *Fn = - Intrinsic::getDeclaration(I->getModule(), Intrinsic::vscale, {Ty}); + Function *Fn = Intrinsic::getOrInsertDeclaration( + I->getModule(), Intrinsic::vscale, {Ty}); Res = CallInst::Create(Fn->getFunctionType(), Fn); break; } @@ -600,7 +600,8 @@ Instruction *InstCombinerImpl::narrowFunnelShift(TruncInst &Trunc) { if (ShVal0 != ShVal1) Y = Builder.CreateTrunc(ShVal1, DestTy); Intrinsic::ID IID = IsFshl ? Intrinsic::fshl : Intrinsic::fshr; - Function *F = Intrinsic::getDeclaration(Trunc.getModule(), IID, DestTy); + Function *F = + Intrinsic::getOrInsertDeclaration(Trunc.getModule(), IID, DestTy); return CallInst::Create(F, {X, Y, NarrowShAmt}); } @@ -1912,8 +1913,8 @@ Instruction *InstCombinerImpl::visitFPTrunc(FPTruncInst &FPT) { // Do unary FP operation on smaller type. // (fptrunc (fabs x)) -> (fabs (fptrunc x)) Value *InnerTrunc = Builder.CreateFPTrunc(Src, Ty); - Function *Overload = Intrinsic::getDeclaration(FPT.getModule(), - II->getIntrinsicID(), Ty); + Function *Overload = Intrinsic::getOrInsertDeclaration( + FPT.getModule(), II->getIntrinsicID(), Ty); SmallVector<OperandBundleDef, 1> OpBundles; II->getOperandBundlesAsDefs(OpBundles); CallInst *NewCI = @@ -2855,8 +2856,8 @@ Instruction *InstCombinerImpl::visitBitCast(BitCastInst &CI) { if (IntrinsicNum != 0) { assert(ShufOp0->getType() == SrcTy && "Unexpected shuffle mask"); assert(match(ShufOp1, m_Undef()) && "Unexpected shuffle op"); - Function *BswapOrBitreverse = - Intrinsic::getDeclaration(CI.getModule(), IntrinsicNum, DestTy); + Function *BswapOrBitreverse = Intrinsic::getOrInsertDeclaration( + CI.getModule(), IntrinsicNum, DestTy); Value *ScalarX = Builder.CreateBitCast(ShufOp0, DestTy); return CallInst::Create(BswapOrBitreverse, {ScalarX}); } |
