Teach loop rotate to hoist trivially invariant instructions
commit5c4846698cfc270c3e358c1888c6392e07870dd0
authorChris Lattner <sabre@nondot.org>
Mon, 6 Sep 2010 01:10:22 +0000 (6 01:10 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 6 Sep 2010 01:10:22 +0000 (6 01:10 +0000)
tree37d2530f9bdaa937d848861d34ebd2bd584ece6a
parent7c69f7370c2984ede14f3a9bb6b8c7703224cf8b
Teach loop rotate to hoist trivially invariant instructions
in the duplicated block instead of duplicating them.

Duplicating them into the end of the loop and the preheader
means that we got a phi node in the header of the loop,
which prevented LICM from hoisting them.  GVN would
usually come around later and merge the duplicated
instructions so we'd get reasonable output... except that
anything dependent on the shoulda-been-hoisted value can't
be hoisted.  In PR5319 (which this fixes), a memory value
didn't get promoted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113134 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/LoopRotation.cpp
test/Transforms/LoopRotate/basic.ll [new file with mode: 0644]