[llvm-commits] [PATCH] fix infinite loop in instcombine with more than 4GB memcpy

Eli Friedman eli.friedman at gmail.com
Tue Aug 14 17:41:21 PDT 2012


On Tue, Aug 14, 2012 at 5:30 PM, Michael Liao <michael.liao at intel.com> wrote:
> Hi
>
> Please review the patch fixing a possible infinite loop in instcombine
> if memcpy size is larger than 4GB. The root cause is that memcpy size is
> wrongly truncated into 32-bit instead of 64-bit.
>
> The other changes includes replacing 0-checking with assertion as
> 0-sized memcpy/set is already removed in visitCallInst before calling
> into memcpy/set simplification. The other reason is that returning the
> same inst won't cause memcpy/set removed as they are not trivially dead
> inst.
>
> Test case is revised.

Hmm... the way memset and friends are defined doesn't actually
guarantee that the getZExtValue call is valid; while you're here, can
you change it to use getLimitedValue() or something like that?

Otherwise, looks fine.

-Eli



More information about the llvm-commits mailing list