llvm.org GIT mirror llvm / 406f960
[SelectionDAG] Teach BaseIndexOffset::match to unwrap the base after looking through an add/or We might find a target specific node that needs to be unwrapped after we look through an add/or. Otherwise we get inconsistent results if one pointer is just X86WrapperRIP and the other is (add X86WrapperRIP, C) Differential Revision: https://reviews.llvm.org/D54818 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347591 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 11 months ago
2 changed file(s) with 5 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
106106 if (auto *C = dyn_cast(Base->getOperand(1)))
107107 if (DAG.MaskedValueIsZero(Base->getOperand(0), C->getAPIntValue())) {
108108 Offset += C->getSExtValue();
109 Base = Base->getOperand(0);
109 Base = DAG.getTargetLoweringInfo().unwrapAddress(Base->getOperand(0));
110110 continue;
111111 }
112112 break;
113113 case ISD::ADD:
114114 if (auto *C = dyn_cast(Base->getOperand(1))) {
115115 Offset += C->getSExtValue();
116 Base = Base->getOperand(0);
116 Base = DAG.getTargetLoweringInfo().unwrapAddress(Base->getOperand(0));
117117 continue;
118118 }
119119 break;
129129 Offset -= Off;
130130 else
131131 Offset += Off;
132 Base = LSBase->getBasePtr();
132 Base = DAG.getTargetLoweringInfo().unwrapAddress(LSBase->getBasePtr());
133133 continue;
134134 }
135135 break;
1010 define void @foo2() {
1111 ; CHECK-LABEL: foo2:
1212 ; CHECK: # %bb.0: # %entry
13 ; CHECK-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
14 ; CHECK-NEXT: movhpd {{.*#+}} xmm0 = xmm0[0],mem[0]
15 ; CHECK-NEXT: movapd %xmm0, {{.*}}(%rip)
13 ; CHECK-NEXT: movaps {{.*}}(%rip), %xmm0
14 ; CHECK-NEXT: movaps %xmm0, {{.*}}(%rip)
1615 ; CHECK-NEXT: retq
1716 entry:
1817 %0 = load <2 x float>, <2 x float>* bitcast (float* getelementptr inbounds ([4 x float], [4 x float]* @f, i64 0, i64 2) to <2 x float>*), align 8