@@ -15236,41 +15236,6 @@ SDValue SITargetLowering::performPtrAddCombine(SDNode *N,
1523615236 return Folded;
1523715237 }
1523815238
15239- // Transform (ptradd a, b) -> (or disjoint a, b) if it is equivalent and if
15240- // that transformation can't block an offset folding at any use of the ptradd.
15241- // This should be done late, after legalization, so that it doesn't block
15242- // other ptradd combines that could enable more offset folding.
15243- bool HasIntermediateAssertAlign =
15244- N0->getOpcode() == ISD::AssertAlign && N0->getOperand(0)->isAnyAdd();
15245- // This is a hack to work around an ordering problem for DAGs like this:
15246- // (ptradd (AssertAlign (ptradd p, c1), k), c2)
15247- // If the outer ptradd is handled first by the DAGCombiner, it can be
15248- // transformed into a disjoint or. Then, when the generic AssertAlign combine
15249- // pushes the AssertAlign through the inner ptradd, it's too late for the
15250- // ptradd reassociation to trigger.
15251- if (!DCI.isBeforeLegalizeOps() && !HasIntermediateAssertAlign &&
15252- DAG.haveNoCommonBitsSet(N0, N1)) {
15253- bool TransformCanBreakAddrMode = any_of(N->users(), [&](SDNode *User) {
15254- if (auto *LoadStore = dyn_cast<MemSDNode>(User);
15255- LoadStore && LoadStore->getBasePtr().getNode() == N) {
15256- unsigned AS = LoadStore->getAddressSpace();
15257- // Currently, we only really need ptradds to fold offsets into flat
15258- // memory instructions.
15259- if (AS != AMDGPUAS::FLAT_ADDRESS)
15260- return false;
15261- TargetLoweringBase::AddrMode AM;
15262- AM.HasBaseReg = true;
15263- EVT VT = LoadStore->getMemoryVT();
15264- Type *AccessTy = VT.getTypeForEVT(*DAG.getContext());
15265- return isLegalAddressingMode(DAG.getDataLayout(), AM, AccessTy, AS);
15266- }
15267- return false;
15268- });
15269-
15270- if (!TransformCanBreakAddrMode)
15271- return DAG.getNode(ISD::OR, DL, VT, N0, N1, SDNodeFlags::Disjoint);
15272- }
15273-
1527415239 if (N1.getOpcode() != ISD::ADD || !N1.hasOneUse())
1527515240 return SDValue();
1527615241
0 commit comments