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