[PowerPC] Don't apply the PPC64 address-formation peephole for offsets greater than 7
authorHal Finkel <hfinkel@anl.gov>
Fri, 2 Sep 2016 00:28:20 +0000 (00:28 +0000)
committerHal Finkel <hfinkel@anl.gov>
Fri, 2 Sep 2016 00:28:20 +0000 (00:28 +0000)
commitb54579fab6571501f9e82a3e413ad36fd34aaa75
tree90547e1d913da5243389b2bd243efcfea2bc786c
parent1e8218cc095cb7c7a4897e846b60e0672ed49271
[PowerPC] Don't apply the PPC64 address-formation peephole for offsets greater than 7

When applying our address-formation PPC64 peephole, we are reusing the @ha TOC
addis value with the low parts associated with different offsets (i.e.
different effective symbol addends). We were assuming this was okay so long as
the offsets were less than the alignment of the global variable being accessed.
This ignored the fact, however, that the TOC base pointer itself need only be
8-byte aligned. As a result, what we were doing is legal only for offsets less
than 8 regardless of the alignment of the object being accessed.

Fixes PR28727.

llvm-svn: 280441
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
llvm/test/CodeGen/PowerPC/peephole-align.ll