[PATCH] Retain alignment requirements for load->selects modified by DAGCombine

Owen Anderson resistor at mac.com
Wed Jul 30 10:58:10 PDT 2014


Perhaps this optimization should be disabled if it would reduce alignment and the target does not support unaligned accesses?  See TargetLoweringBase::allowsMisalignedMemoryAccesses() for a way to determine this.

—Owen

On Jul 30, 2014, at 10:40 AM, Louis Gerbarg <lgg at apple.com> wrote:

> This patch fixes an issue where we can generate aligned loads for unaligned data. It is a latent bug that has been around for years, but we have started tripping it recently with the introduction of more aggressive vectorization, etc. On x86 this manifests as generating a movapd when we should have used a movupd, which then results in a segfault if the data does not happened to be aligned. The problem is in platform independent codegen, so this may manifest on other architectures as well. I suspect on PPC this may result in some subtle data corruption bugs since altivec loads will take an unaligned address without faulting and just ignore the low bits.
> 
> Tests included.
> 
> Louis
> 
> <0001-Retain-alignment-requirements-for-load-selects-modif.patch>_______________________________________________
> 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