[PATCH] D41578: [SCEV] Do not cache S -> V if S is not equivalent of V
Evgeny Astigeevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 17 11:12:23 PST 2018
eastig added a comment.
Hi Sergey and Sanjoy,
To set flags ScalarEvolution::createSCEV calls:
SCEV::NoWrapFlags ScalarEvolution::getNoWrapFlagsFromUB(const Value *V) {
if (isa<ConstantExpr>(V)) return SCEV::FlagAnyWrap;
const BinaryOperator *BinOp = cast<BinaryOperator>(V);
// Return early if there are no flags to propagate to the SCEV.
SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap;
if (BinOp->hasNoUnsignedWrap())
Flags = ScalarEvolution::setFlags(Flags, SCEV::FlagNUW);
if (BinOp->hasNoSignedWrap())
Flags = ScalarEvolution::setFlags(Flags, SCEV::FlagNSW);
if (Flags == SCEV::FlagAnyWrap)
return SCEV::FlagAnyWrap;
return isSCEVExprNeverPoison(BinOp) ? Flags : SCEV::FlagAnyWrap;
}
For "%mul86.i = mul nuw nsw i32 %p280, %p281" isSCEVExprNeverPoison return false which causes the SCEV '(%p280 * %p281)' to have SCEV::FlagAnyWrap instead of a combination of SCEV::FlagNUW and Flags, SCEV::FlagNSW.
Am I correct SCEV::FlagAnyWrap means no poisoned values? If so, this looks strange. Shouldn't it be:
return isSCEVExprNeverPoison(BinOp) ? SCEV::FlagAnyWrap : Flags;
Repository:
rL LLVM
https://reviews.llvm.org/D41578
More information about the llvm-commits
mailing list