[PATCH] D90338: [SCEV] Infer addrec nowrap flags while calculating ranges (WIP)
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 18 02:16:47 PST 2021
mkazantsev added inline comments.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:5701
+ MaxBECountValue, BitWidth, /* Signed = */ true);
+ RangeAndFlags SignedRes(SignedRes1.first.unionWith(SignedRes2.first),
+ maskFlags(SignedRes1.second, SignedRes2.second));
----------------
I understand why the union will retain `nsw` in this case, but what about `nuw`? See example in my comment below.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:5893
+ return {TrueRes.first.unionWith(FalseRes.first),
+ maskFlags(TrueRes.second, FalseRes.second)};
}
----------------
If first range is `[-5; -1]<nuw><nsw>` and second range is `[1; 5]<nuw><nsw>`, we'll end up with smth like `[-5; 5]<nuw><nsw>`. This doesn't feel right.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90338/new/
https://reviews.llvm.org/D90338
More information about the llvm-commits
mailing list