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

Eli Friedman eli.friedman at gmail.com
Tue Aug 14 20:44:25 PDT 2012


On Tue, Aug 14, 2012 at 8:34 PM, Michael Liao <michael.liao at intel.com> wrote:
> On Tue, 2012-08-14 at 17:41 -0700, Eli Friedman wrote:
>> 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?
>
> Sure, revised patch is attached.

Looks good; please commit.

-Eli



More information about the llvm-commits mailing list