[PATCH] Fix aliasing issue caused by MemCpyOptimizer (PR18304)

David Wiberg dwiberg at gmail.com
Sat Jun 21 13:49:25 PDT 2014


2014-06-21 1:29 GMT+02:00 Philip Reames <listmail at philipreames.com>:
> Your change does address a correctness issue and does so in a reasonable
> way.  I wouldn't worry too much about the possible performance regression.
>
> One mandatory change:
> - Add a test case which checks the optimization does not apply when accessed
> via capturing parameter.
>
> I'd also prefer that you:
> - either use std::distance (rather than iterator subtraction) or (preferred)
> use a argument number indexed loop.
> - If you keep the iterator loop, consider a range loop.  Or at least move
> the declaration of B, E into the initializer of the loop to restrict their
> scope.
>
> Philip
>

Thanks for the review. I have added a test case and changed to use an
argument number indexed loop (hopefully) as per your suggestion, see
attached patch.

David

>
> On 06/20/2014 06:13 AM, David Wiberg wrote:
>
> Hello,
>
> The attached patch fixes an aliasing issue caused by MemCpyOptimizer
> by performing the following changes:
> - Added requirement that the callee does not capture the src pointer for
>   the transformation to apply.
> - Updated test cases by adding nocapture attributes where applicable
>
> See http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-June/073819.html
> for some more information. My main concern is performance regressions
> but I haven't been able to get any benchmark results.
>
> Best regards
> David
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr18304-2.patch
Type: application/octet-stream
Size: 4733 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140621/6311233b/attachment.obj>


More information about the llvm-commits mailing list