OSDN Git Service

Non-volatile loads can be freely reordered against each other. This fixes
authorChris Lattner <sabre@nondot.org>
Mon, 17 Jan 2005 22:19:26 +0000 (22:19 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 17 Jan 2005 22:19:26 +0000 (22:19 +0000)
commitd3948116b81b11e82246c11389a9b4ce7e619fbb
tree5ed03fdd38d9e88a89ff0384f02ca7d033887ad6
parent5c65981a576a8669d90e92743cfc853d440dd246
Non-volatile loads can be freely reordered against each other.  This fixes
X86/reg-pressure.ll again, and allows us to do nice things in other cases.
For example, we now codegen this sort of thing:

int %loadload(int *%X, int* %Y) {
  %Z = load int* %Y
  %Y = load int* %X      ;; load between %Z and store
  %Q = add int %Z, 1
  store int %Q, int* %Y
  ret int %Y
}

Into this:

loadload:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EAX, DWORD PTR [%EAX]
        mov %ECX, DWORD PTR [%ESP + 8]
        inc DWORD PTR [%ECX]
        ret

where we weren't able to form the 'inc [mem]' before.  This also lets the
instruction selector emit loads in any order it wants to, which can be good
for register pressure as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19644 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp