[MachineLICM] Add functions to MachineLICM to hoist invariant stores
authorZaara Syeda <syzaara@ca.ibm.com>
Mon, 19 Mar 2018 14:52:25 +0000 (14:52 +0000)
committerZaara Syeda <syzaara@ca.ibm.com>
Mon, 19 Mar 2018 14:52:25 +0000 (14:52 +0000)
commitff05e2b0e609a10ac7ab1db445ffdba24319d50d
treeaa43bbdf11411c98ab7670b00081e4db4dad32c6
parent30c38c38497763d5660fde146e1185c0dbb082d5
[MachineLICM] Add functions to MachineLICM to hoist invariant stores

This patch adds functions to allow MachineLICM to hoist invariant stores.
Currently, MachineLICM does not hoist any store instructions, however
when storing the same value to a constant spot on the stack, the store
instruction should be considered invariant and be hoisted. The function
isInvariantStore iterates each operand of the store instruction and checks
that each register operand satisfies isCallerPreservedPhysReg. The store
may be fed by a copy, which is hoisted by isCopyFeedingInvariantStore.
This patch also adds the PowerPC changes needed to consider the stack
register as caller preserved.

Differential Revision: https://reviews.llvm.org/D40196

llvm-svn: 327856
llvm/include/llvm/CodeGen/TargetRegisterInfo.h
llvm/lib/CodeGen/MachineLICM.cpp
llvm/lib/CodeGen/TargetRegisterInfo.cpp
llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
llvm/lib/Target/PowerPC/PPCInstrInfo.h
llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
llvm/test/CodeGen/PowerPC/extra-toc-reg-deps.ll
llvm/test/CodeGen/PowerPC/loop-hoist-toc-save.ll [new file with mode: 0644]
llvm/test/CodeGen/PowerPC/ppc64-func-desc-hoist.ll