ARM: Introduce conservative load/store optimization mode
authorMatthias Braun <matze@braunis.de>
Wed, 2 Mar 2016 19:20:00 +0000 (19:20 +0000)
committerMatthias Braun <matze@braunis.de>
Wed, 2 Mar 2016 19:20:00 +0000 (19:20 +0000)
commitf290912d2248687e688779d1d89999df56c14a09
tree3fcf0e6854ae16ba357b814c0a0a16f1a88f313c
parent578787ad3055d0a874bb76b148a9d5dc7bd18db5
ARM: Introduce conservative load/store optimization mode

Most of the time ARM has the CCR.UNALIGN_TRP bit set to false which
means that unaligned loads/stores do not trap and even extensive testing
will not catch these bugs. However the multi/double variants are not
affected by this bit and will still trap. In effect a more aggressive
load/store optimization will break existing (bad) code.

These bugs do not necessarily manifest in the broken code where the
misaligned pointer is formed but often later in perfectly legal code
where it is accessed. This means recompiling system libraries (which
have no alignment bugs) with a newer compiler will break existing
applications (with alignment bugs) that worked before.

So (under protest) I implemented this safe mode which limits the
formation of multi/double operations to cases that are not affected by
user code (stack operations like spills/reloads) or cases where the
normal operations trap anyway (floating point load/stores). It is
disabled by default.

Differential Revision: http://reviews.llvm.org/D17015

llvm-svn: 262504
llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
llvm/test/CodeGen/ARM/ldrd.ll
llvm/test/CodeGen/ARM/swift-vldm.ll
llvm/test/CodeGen/Thumb2/thumb2-ldm.ll