@@ -16145,41 +16145,6 @@ SDValue SITargetLowering::performPtrAddCombine(SDNode *N,
1614516145 return Folded;
1614616146 }
1614716147
16148- // Transform (ptradd a, b) -> (or disjoint a, b) if it is equivalent and if
16149- // that transformation can't block an offset folding at any use of the ptradd.
16150- // This should be done late, after legalization, so that it doesn't block
16151- // other ptradd combines that could enable more offset folding.
16152- bool HasIntermediateAssertAlign =
16153- N0->getOpcode() == ISD::AssertAlign && N0->getOperand(0)->isAnyAdd();
16154- // This is a hack to work around an ordering problem for DAGs like this:
16155- // (ptradd (AssertAlign (ptradd p, c1), k), c2)
16156- // If the outer ptradd is handled first by the DAGCombiner, it can be
16157- // transformed into a disjoint or. Then, when the generic AssertAlign combine
16158- // pushes the AssertAlign through the inner ptradd, it's too late for the
16159- // ptradd reassociation to trigger.
16160- if (!DCI.isBeforeLegalizeOps() && !HasIntermediateAssertAlign &&
16161- DAG.haveNoCommonBitsSet(N0, N1)) {
16162- bool TransformCanBreakAddrMode = any_of(N->users(), [&](SDNode *User) {
16163- if (auto *LoadStore = dyn_cast<MemSDNode>(User);
16164- LoadStore && LoadStore->getBasePtr().getNode() == N) {
16165- unsigned AS = LoadStore->getAddressSpace();
16166- // Currently, we only really need ptradds to fold offsets into flat
16167- // memory instructions.
16168- if (AS != AMDGPUAS::FLAT_ADDRESS)
16169- return false;
16170- TargetLoweringBase::AddrMode AM;
16171- AM.HasBaseReg = true;
16172- EVT VT = LoadStore->getMemoryVT();
16173- Type *AccessTy = VT.getTypeForEVT(*DAG.getContext());
16174- return isLegalAddressingMode(DAG.getDataLayout(), AM, AccessTy, AS);
16175- }
16176- return false;
16177- });
16178-
16179- if (!TransformCanBreakAddrMode)
16180- return DAG.getNode(ISD::OR, DL, VT, N0, N1, SDNodeFlags::Disjoint);
16181- }
16182-
1618316148 if (N1.getOpcode() != ISD::ADD || !N1.hasOneUse())
1618416149 return SDValue();
1618516150
0 commit comments