[llvm] PreISelIntrinsicLowering: Lower llvm.exp to a loop if scalable vec arg (PR #117568)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 4 12:51:32 PST 2024
================
@@ -32,26 +28,34 @@ bool llvm::lowerUnaryMathIntrinsicWithScalableVecArgAsLoop(Module &M,
BasicBlock *LoopBB = BasicBlock::Create(Ctx, "", ParentFunc, PostLoopBB);
PreLoopBB->getTerminator()->setSuccessor(0, LoopBB);
- // loop preheader
+ // Loop preheader
IRBuilder<> PreLoopBuilder(PreLoopBB->getTerminator());
- Value *VScale = PreLoopBuilder.CreateVScale(
- ConstantInt::get(PreLoopBuilder.getInt64Ty(), 1));
- Value *N = ConstantInt::get(PreLoopBuilder.getInt64Ty(),
- ScalableTy->getMinNumElements());
- Value *LoopEnd = PreLoopBuilder.CreateMul(VScale, N);
+ Value *LoopEnd = nullptr;
+ if (VecTy->isScalableTy()) {
+ ScalableVectorType *ScalableVecTy = cast<ScalableVectorType>(VecTy);
----------------
arsenm wrote:
dyn_cast instead of cast + isScalableTy
https://github.com/llvm/llvm-project/pull/117568
More information about the llvm-commits
mailing list