Tighten iaddroff ComplexPattern.

The iaddroff ComplexPattern is supposed to recognize displacement
expressions that have been processed by a SelectAddressRegImm,
which means it needs to accept TargetConstant and TargetGlobalAddress
nodes.  Currently, it erroneously also accepts some other nodes,
in particular Constant and PPCISD::Lo.

While this problem is currently latent, it would cause wrong-code
bugs with a follow-on patch I'm about to commit, so this patch
tightens the ComplexPattern.  The equivalent change is made in
PPCDAGToDAGISel::Select, where pre-inc load patterns are handled
(as opposed to store patterns, the loads are handled in C++ code
without making use of the .td ComplexPattern).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177732 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Ulrich Weigand 2013-03-22 14:58:17 +00:00
parent cff0faa16a
commit 0301e79a1a

View File

@ -120,10 +120,10 @@ namespace {
} }
/// SelectAddrImmOffs - Return true if the operand is valid for a preinc /// SelectAddrImmOffs - Return true if the operand is valid for a preinc
/// immediate field. Because preinc imms have already been validated, just /// immediate field. Note that the operand at this point is already the
/// accept it. /// result of a prior SelectAddressRegImm call.
bool SelectAddrImmOffs(SDValue N, SDValue &Out) const { bool SelectAddrImmOffs(SDValue N, SDValue &Out) const {
if (isa<ConstantSDNode>(N) || N.getOpcode() == PPCISD::Lo || if (N.getOpcode() == ISD::TargetConstant ||
N.getOpcode() == ISD::TargetGlobalAddress) { N.getOpcode() == ISD::TargetGlobalAddress) {
Out = N; Out = N;
return true; return true;
@ -1044,7 +1044,7 @@ SDNode *PPCDAGToDAGISel::Select(SDNode *N) {
break; break;
SDValue Offset = LD->getOffset(); SDValue Offset = LD->getOffset();
if (isa<ConstantSDNode>(Offset) || if (Offset.getOpcode() == ISD::TargetConstant ||
Offset.getOpcode() == ISD::TargetGlobalAddress) { Offset.getOpcode() == ISD::TargetGlobalAddress) {
unsigned Opcode; unsigned Opcode;