[llvm] c0f2774 - [NFC][LoopVectorize] Simple tidy-up in InnerLoopVectorizer::createVectorIntOrFpInductionPHI
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 3 07:05:27 PDT 2021
Author: David Sherwood
Date: 2021-11-03T14:05:21Z
New Revision: c0f277497381ea91a1b9289679406d771f1405e2
URL: https://github.com/llvm/llvm-project/commit/c0f277497381ea91a1b9289679406d771f1405e2
DIFF: https://github.com/llvm/llvm-project/commit/c0f277497381ea91a1b9289679406d771f1405e2.diff
LOG: [NFC][LoopVectorize] Simple tidy-up in InnerLoopVectorizer::createVectorIntOrFpInductionPHI
Use getSignedIntOrFpConstant instead of creating int or FP constants
manually.
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 47a9223bcb02..1c6f252cfae9 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -2294,12 +2294,7 @@ void InnerLoopVectorizer::createVectorIntOrFpInductionPHI(
Start = Builder.CreateCast(Instruction::Trunc, Start, TruncType);
}
- Value *Zero;
- if (Start->getType()->isFloatingPointTy())
- Zero = ConstantFP::get(Start->getType(), 0);
- else
- Zero = ConstantInt::get(Start->getType(), 0);
-
+ Value *Zero = getSignedIntOrFpConstant(Start->getType(), 0);
Value *SplatStart = Builder.CreateVectorSplat(VF, Start);
Value *SteppedStart =
getStepVector(SplatStart, Zero, Step, II.getInductionOpcode());
More information about the llvm-commits
mailing list