mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
Add a convenience method to copy wrapping, exact, and fast-math flags (NFC).
The loop vectorizer preserves wrapping, exact, and fast-math properties of scalar instructions. This patch adds a convenience method to make that operation easier because we need to do this in the loop vectorizer, SLP vectorizer, and possibly other places. Although this is a 'no functional change' patch, I've added a testcase to verify that the exact flag is preserved by the loop vectorizer. The wrapping and fast-math flags are already checked in existing testcases. Differential Revision: http://reviews.llvm.org/D5138 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216886 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -3248,19 +3248,9 @@ void InnerLoopVectorizer::vectorizeBlockInLoop(BasicBlock *BB, PhiVector *PV) {
|
||||
for (unsigned Part = 0; Part < UF; ++Part) {
|
||||
Value *V = Builder.CreateBinOp(BinOp->getOpcode(), A[Part], B[Part]);
|
||||
|
||||
// Update the NSW, NUW and Exact flags. Notice: V can be an Undef.
|
||||
BinaryOperator *VecOp = dyn_cast<BinaryOperator>(V);
|
||||
if (VecOp && isa<OverflowingBinaryOperator>(BinOp)) {
|
||||
VecOp->setHasNoSignedWrap(BinOp->hasNoSignedWrap());
|
||||
VecOp->setHasNoUnsignedWrap(BinOp->hasNoUnsignedWrap());
|
||||
}
|
||||
if (VecOp && isa<PossiblyExactOperator>(VecOp))
|
||||
VecOp->setIsExact(BinOp->isExact());
|
||||
|
||||
// Copy the fast-math flags.
|
||||
if (VecOp && isa<FPMathOperator>(V))
|
||||
VecOp->setFastMathFlags(it->getFastMathFlags());
|
||||
|
||||
if (BinaryOperator *VecOp = dyn_cast<BinaryOperator>(V))
|
||||
VecOp->copyFlags(BinOp);
|
||||
|
||||
Entry[Part] = V;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user