@@ -15433,41 +15433,6 @@ SDValue SITargetLowering::performPtrAddCombine(SDNode *N,
1543315433 return Folded;
1543415434 }
1543515435
15436- // Transform (ptradd a, b) -> (or disjoint a, b) if it is equivalent and if
15437- // that transformation can't block an offset folding at any use of the ptradd.
15438- // This should be done late, after legalization, so that it doesn't block
15439- // other ptradd combines that could enable more offset folding.
15440- bool HasIntermediateAssertAlign =
15441- N0->getOpcode() == ISD::AssertAlign && N0->getOperand(0)->isAnyAdd();
15442- // This is a hack to work around an ordering problem for DAGs like this:
15443- // (ptradd (AssertAlign (ptradd p, c1), k), c2)
15444- // If the outer ptradd is handled first by the DAGCombiner, it can be
15445- // transformed into a disjoint or. Then, when the generic AssertAlign combine
15446- // pushes the AssertAlign through the inner ptradd, it's too late for the
15447- // ptradd reassociation to trigger.
15448- if (!DCI.isBeforeLegalizeOps() && !HasIntermediateAssertAlign &&
15449- DAG.haveNoCommonBitsSet(N0, N1)) {
15450- bool TransformCanBreakAddrMode = any_of(N->users(), [&](SDNode *User) {
15451- if (auto *LoadStore = dyn_cast<MemSDNode>(User);
15452- LoadStore && LoadStore->getBasePtr().getNode() == N) {
15453- unsigned AS = LoadStore->getAddressSpace();
15454- // Currently, we only really need ptradds to fold offsets into flat
15455- // memory instructions.
15456- if (AS != AMDGPUAS::FLAT_ADDRESS)
15457- return false;
15458- TargetLoweringBase::AddrMode AM;
15459- AM.HasBaseReg = true;
15460- EVT VT = LoadStore->getMemoryVT();
15461- Type *AccessTy = VT.getTypeForEVT(*DAG.getContext());
15462- return isLegalAddressingMode(DAG.getDataLayout(), AM, AccessTy, AS);
15463- }
15464- return false;
15465- });
15466-
15467- if (!TransformCanBreakAddrMode)
15468- return DAG.getNode(ISD::OR, DL, VT, N0, N1, SDNodeFlags::Disjoint);
15469- }
15470-
1547115436 if (N1.getOpcode() != ISD::ADD || !N1.hasOneUse())
1547215437 return SDValue();
1547315438
0 commit comments