Skip to content

Commit f41fecf

Browse files
committed
use sadd_ov
1 parent 65d838b commit f41fecf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/Transforms/IPO/FunctionAttrs.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,9 +662,10 @@ ArgumentAccessInfo getArgumentAccessInfo(const Instruction *I,
662662
if (!TypeSize.isScalable() && Offset) {
663663
int64_t Size = TypeSize.getFixedValue();
664664
APInt Low(64, *Offset, true);
665-
APInt High(64, *Offset + Size, true);
665+
bool Overflow;
666+
APInt High = Low.sadd_ov(APInt(64, Size, true), Overflow);
666667
// Bail if the range overflows signed 64-bit int.
667-
if (Low.sge(High))
668+
if (Overflow)
668669
return std::nullopt;
669670
return ConstantRange(Low, High);
670671
}

0 commit comments

Comments
 (0)