@@ -15822,41 +15822,6 @@ SDValue SITargetLowering::performPtrAddCombine(SDNode *N,
1582215822 return Folded;
1582315823 }
1582415824
15825- // Transform (ptradd a, b) -> (or disjoint a, b) if it is equivalent and if
15826- // that transformation can't block an offset folding at any use of the ptradd.
15827- // This should be done late, after legalization, so that it doesn't block
15828- // other ptradd combines that could enable more offset folding.
15829- bool HasIntermediateAssertAlign =
15830- N0->getOpcode() == ISD::AssertAlign && N0->getOperand(0)->isAnyAdd();
15831- // This is a hack to work around an ordering problem for DAGs like this:
15832- // (ptradd (AssertAlign (ptradd p, c1), k), c2)
15833- // If the outer ptradd is handled first by the DAGCombiner, it can be
15834- // transformed into a disjoint or. Then, when the generic AssertAlign combine
15835- // pushes the AssertAlign through the inner ptradd, it's too late for the
15836- // ptradd reassociation to trigger.
15837- if (!DCI.isBeforeLegalizeOps() && !HasIntermediateAssertAlign &&
15838- DAG.haveNoCommonBitsSet(N0, N1)) {
15839- bool TransformCanBreakAddrMode = any_of(N->users(), [&](SDNode *User) {
15840- if (auto *LoadStore = dyn_cast<MemSDNode>(User);
15841- LoadStore && LoadStore->getBasePtr().getNode() == N) {
15842- unsigned AS = LoadStore->getAddressSpace();
15843- // Currently, we only really need ptradds to fold offsets into flat
15844- // memory instructions.
15845- if (AS != AMDGPUAS::FLAT_ADDRESS)
15846- return false;
15847- TargetLoweringBase::AddrMode AM;
15848- AM.HasBaseReg = true;
15849- EVT VT = LoadStore->getMemoryVT();
15850- Type *AccessTy = VT.getTypeForEVT(*DAG.getContext());
15851- return isLegalAddressingMode(DAG.getDataLayout(), AM, AccessTy, AS);
15852- }
15853- return false;
15854- });
15855-
15856- if (!TransformCanBreakAddrMode)
15857- return DAG.getNode(ISD::OR, DL, VT, N0, N1, SDNodeFlags::Disjoint);
15858- }
15859-
1586015825 if (N1.getOpcode() != ISD::ADD || !N1.hasOneUse())
1586115826 return SDValue();
1586215827
0 commit comments