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

Michael Liao michael.liao at intel.com
Tue Aug 14 20:34:19 PDT 2012


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.

- Michael

> 
> Otherwise, looks fine.
> 
> -Eli

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fix-infinite-loop-in-instcombine-with-more-than-4GB-.patch
Type: text/x-patch
Size: 3120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120814/55c8c55e/attachment.bin>


More information about the llvm-commits mailing list