[llvm-commits] Invalid instcombine transformation

Evan Cheng evan.cheng at apple.com
Tue Mar 16 10:30:58 PDT 2010


Was this ever fixed?

Evan
On Nov 26, 2009, at 12:25 PM, Anton Korobeynikov wrote:

> Hello, Everyone
> 
> Currently instcombine turns small memcpy's (say, of 1/2/4/8 bytes)
> into loads / stores. This seems to be invalid if target does not allow
> unaligned access (and even if it allows, it's slower in general).
> Consider ARM, there we have:
> 
> 1. Byte loads / stores => no alignment requirement
> 2. 2-byte loads / stores => 16 bit alignment requirement
> 3. 4-byte loads / stores => 32 bit alignment requirement
> 
> In case of misaligned access in cases 2 and 3 it can be either "fixed"
> (if the processor is configured so), or trap (it it doesn't configured
> so).
> 
> memcpy allows arbitrary alignment. In such situation, turn of e.g.
> memcpy(i8*, i8*, 2, 1) and memcpy(i8*, i8*, 4, 1) into loads / stores
> is invalid and thus the transform should be disabled. Same applies to
> memset.
> 
> Attached patch allows memcpy => load/store transformation only if memcpy
> alignment is not lower than ABI alignment of the load/store type (when
> TargetData is available).
> 
> This fixed several bugs in real code running on ARM.
> 
> Ok to commit?
> 
> -- 
> With best regards, Anton Korobeynikov.
> 
> Faculty of Mathematics & Mechanics, Saint Petersburg State University.
> <instcombine-unaligned.diff>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list