mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-26 09:18:56 +00:00
SCEV fix. In general, Add/Mul expressions should not inherit NSW/NUW.
This reverts r139450, fixes r139453, and adds much needed comments and a unit test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145367 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -944,9 +944,13 @@ const SCEVAddRecExpr* WidenIV::GetExtendedOperandRecurrence(NarrowIVDefUse DU) {
|
||||
else
|
||||
return 0;
|
||||
|
||||
// When creating this AddExpr, don't apply the current operations NSW or NUW
|
||||
// flags. This instruction may be guarded by control flow that the no-wrap
|
||||
// behavior depends on. Non-control-equivalent instructions can be mapped to
|
||||
// the same SCEV expression, and it would be incorrect to transfer NSW/NUW
|
||||
// semantics to those operations.
|
||||
const SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(
|
||||
SE->getAddExpr(SE->getSCEV(DU.WideDef), ExtendOperExpr,
|
||||
IsSigned ? SCEV::FlagNSW : SCEV::FlagNUW));
|
||||
SE->getAddExpr(SE->getSCEV(DU.WideDef), ExtendOperExpr));
|
||||
|
||||
if (!AddRec || AddRec->getLoop() != L)
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user