[FastISel][AArch64] Don't fold instructions too aggressively into the memory operation.
authorJuergen Ributzka <juergen@apple.com>
Wed, 27 Aug 2014 22:52:33 +0000 (22:52 +0000)
committerJuergen Ributzka <juergen@apple.com>
Wed, 27 Aug 2014 22:52:33 +0000 (22:52 +0000)
commit1f5263e43f139b3db74e70d67e1f89ed71c9a318
treee08ca517892dbc126fb3e7d823ea8b3c9b799189
parent96c845a36c38866329edd42850a6f0c541692724
[FastISel][AArch64] Don't fold instructions too aggressively into the memory operation.

Currently instructions are folded very aggressively into the memory operation,
which can lead to the use of killed operands:
  %vreg1<def> = ADDXri %vreg0<kill>, 2
  %vreg2<def> = LDRBBui %vreg0, 2
  ... = ... %vreg1 ...

This usually happens when the result is also used by another non-memory
instruction in the same basic block, or any instruction in another basic block.

If the computed address is used by only memory operations in the same basic
block, then it is safe to fold them. This is because all memory operations will
fold the address computation and the original computation will never be emitted.

This fixes rdar://problem/18142857.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216629 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AArch64/AArch64FastISel.cpp
test/CodeGen/AArch64/fast-isel-addressing-modes.ll