[PATCH][lld] ELF/AArch64: Add support for checking for ABS32 overflow

Tim Northover t.p.northover at gmail.com
Mon Jan 26 10:12:47 PST 2015


> +/// \brief Check X is in the interval (-2^(bits-1), 2^bits]
> +bool withinSignedUnsignedRange(int64_t X, int bits) {

This should probably be a static function.

> +  if (X < -(1L << (bits - 1)) || X >= (1L << bits))

I think long is only 32-bits on Windows, so we should use 1LL (and
assert that Bits < 64, just in case someone tries to extend its use
carelessly later).

Otherwise, it looks reasonable to me, though I'm not really much of an
lld expert.

Tim.



More information about the llvm-commits mailing list