[PATCH] D144565: dwp check overflow
Alexander Yermolovich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 7 11:02:16 PST 2023
ayermolo added inline comments.
================
Comment at: llvm/tools/llvm-dwp/llvm-dwp.cpp:470
bool Overflow = false;
APInt NewOffset = Offset.uadd_ov(NewLength, Overflow);
if (Overflow) {
----------------
ayermolo wrote:
> I think this will break the overflow behavior that llvm patch I references relies on.
>
>
> ```
> APInt APInt::uadd_sat(const APInt &RHS) const {
> bool Overflow;
> APInt Res = uadd_ov(RHS, Overflow);
> if (!Overflow)
> return Res;
>
> return APInt::getMaxValue(BitWidth);
> }
> ```
> I think this will break the overflow behavior that llvm patch I references relies on.
>
>
> ```
> APInt APInt::uadd_sat(const APInt &RHS) const {
> bool Overflow;
> APInt Res = uadd_ov(RHS, Overflow);
> if (!Overflow)
> return Res;
>
> return APInt::getMaxValue(BitWidth);
> }
> ```
================
Comment at: llvm/tools/llvm-dwp/llvm-dwp.cpp:470
bool Overflow = false;
APInt NewOffset = Offset.uadd_ov(NewLength, Overflow);
if (Overflow) {
----------------
ayermolo wrote:
> ayermolo wrote:
> > I think this will break the overflow behavior that llvm patch I references relies on.
> >
> >
> > ```
> > APInt APInt::uadd_sat(const APInt &RHS) const {
> > bool Overflow;
> > APInt Res = uadd_ov(RHS, Overflow);
> > if (!Overflow)
> > return Res;
> >
> > return APInt::getMaxValue(BitWidth);
> > }
> > ```
> > I think this will break the overflow behavior that llvm patch I references relies on.
> >
> >
> > ```
> > APInt APInt::uadd_sat(const APInt &RHS) const {
> > bool Overflow;
> > APInt Res = uadd_ov(RHS, Overflow);
> > if (!Overflow)
> > return Res;
> >
> > return APInt::getMaxValue(BitWidth);
> > }
> > ```
>
>
> I think this will break the overflow behavior that llvm patch I references relies on.
>
>
> ```
> APInt APInt::uadd_sat(const APInt &RHS) const {
> bool Overflow;
> APInt Res = uadd_ov(RHS, Overflow);
> if (!Overflow)
> return Res;
>
> return APInt::getMaxValue(BitWidth);
> }
> ```
errr, messeed up APIs. never mind.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144565/new/
https://reviews.llvm.org/D144565
More information about the llvm-commits
mailing list