@@ -15144,41 +15144,6 @@ SDValue SITargetLowering::performPtrAddCombine(SDNode *N,
1514415144 return Folded;
1514515145 }
1514615146
15147- // Transform (ptradd a, b) -> (or disjoint a, b) if it is equivalent and if
15148- // that transformation can't block an offset folding at any use of the ptradd.
15149- // This should be done late, after legalization, so that it doesn't block
15150- // other ptradd combines that could enable more offset folding.
15151- bool HasIntermediateAssertAlign =
15152- N0->getOpcode() == ISD::AssertAlign && N0->getOperand(0)->isAnyAdd();
15153- // This is a hack to work around an ordering problem for DAGs like this:
15154- // (ptradd (AssertAlign (ptradd p, c1), k), c2)
15155- // If the outer ptradd is handled first by the DAGCombiner, it can be
15156- // transformed into a disjoint or. Then, when the generic AssertAlign combine
15157- // pushes the AssertAlign through the inner ptradd, it's too late for the
15158- // ptradd reassociation to trigger.
15159- if (!DCI.isBeforeLegalizeOps() && !HasIntermediateAssertAlign &&
15160- DAG.haveNoCommonBitsSet(N0, N1)) {
15161- bool TransformCanBreakAddrMode = any_of(N->users(), [&](SDNode *User) {
15162- if (auto *LoadStore = dyn_cast<MemSDNode>(User);
15163- LoadStore && LoadStore->getBasePtr().getNode() == N) {
15164- unsigned AS = LoadStore->getAddressSpace();
15165- // Currently, we only really need ptradds to fold offsets into flat
15166- // memory instructions.
15167- if (AS != AMDGPUAS::FLAT_ADDRESS)
15168- return false;
15169- TargetLoweringBase::AddrMode AM;
15170- AM.HasBaseReg = true;
15171- EVT VT = LoadStore->getMemoryVT();
15172- Type *AccessTy = VT.getTypeForEVT(*DAG.getContext());
15173- return isLegalAddressingMode(DAG.getDataLayout(), AM, AccessTy, AS);
15174- }
15175- return false;
15176- });
15177-
15178- if (!TransformCanBreakAddrMode)
15179- return DAG.getNode(ISD::OR, DL, VT, N0, N1, SDNodeFlags::Disjoint);
15180- }
15181-
1518215147 if (N1.getOpcode() != ISD::ADD || !N1.hasOneUse())
1518315148 return SDValue();
1518415149
0 commit comments