diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp index 3a3bcde..74cffbc 100644 --- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp @@ -59,6 +59,10 @@ PoisonFlags::PoisonFlags(const Instruction *I) { Disjoint = PDI->isDisjoint(); if (auto *PNI = dyn_cast<PossiblyNonNegInst>(I)) NNeg = PNI->hasNonNeg(); + if (auto *TI = dyn_cast<TruncInst>(I)) { + NUW = TI->hasNoUnsignedWrap(); + NSW = TI->hasNoSignedWrap(); + } } void PoisonFlags::apply(Instruction *I) { @@ -72,6 +76,10 @@ void PoisonFlags::apply(Instruction *I) { PDI->setIsDisjoint(Disjoint); if (auto *PNI = dyn_cast<PossiblyNonNegInst>(I)) PNI->setNonNeg(NNeg); + if (isa<TruncInst>(I)) { + I->setHasNoUnsignedWrap(NUW); + I->setHasNoSignedWrap(NSW); + } } /// ReuseOrCreateCast - Arrange for there to be a cast of V to Ty at IP, |