mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-22 10:24:26 +00:00
LoopVectorizer: Fix a bug in the vectorization of BinaryOperators. The BinaryOperator can be folded to an Undef, and we don't want to set NSW flags to undef vals.
PR14878 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172079 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1682,13 +1682,13 @@ InnerLoopVectorizer::vectorizeBlockInLoop(LoopVectorizationLegality *Legal,
|
||||
for (unsigned Part = 0; Part < UF; ++Part) {
|
||||
Value *V = Builder.CreateBinOp(BinOp->getOpcode(), A[Part], B[Part]);
|
||||
|
||||
// Update the NSW, NUW and Exact flags.
|
||||
BinaryOperator *VecOp = cast<BinaryOperator>(V);
|
||||
if (isa<OverflowingBinaryOperator>(BinOp)) {
|
||||
// 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 (isa<PossiblyExactOperator>(VecOp))
|
||||
if (VecOp && isa<PossiblyExactOperator>(VecOp))
|
||||
VecOp->setIsExact(BinOp->isExact());
|
||||
|
||||
Entry[Part] = V;
|
||||
|
Reference in New Issue
Block a user