-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[SelectionDAG] Introduce ISD::PTRADD #140017
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
f3ec47a
ba0b2ee
f6a4cda
d5f083e
759f065
3a38633
2ccad11
4c6ba49
c0ed6a2
1239537
4edcf2f
7329a37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4284,8 +4284,8 @@ void SelectionDAGBuilder::visitGetElementPtr(const User &I) { | |
(int64_t(Offset) >= 0 && NW.hasNoUnsignedSignedWrap())) | ||
Flags |= SDNodeFlags::NoUnsignedWrap; | ||
|
||
N = DAG.getNode(ISD::ADD, dl, N.getValueType(), N, | ||
DAG.getConstant(Offset, dl, N.getValueType()), Flags); | ||
N = DAG.getMemBasePlusOffset( | ||
N, DAG.getConstant(Offset, dl, N.getValueType()), dl, Flags); | ||
} | ||
} else { | ||
// IdxSize is the width of the arithmetic according to IR semantics. | ||
|
@@ -4329,7 +4329,7 @@ void SelectionDAGBuilder::visitGetElementPtr(const User &I) { | |
|
||
OffsVal = DAG.getSExtOrTrunc(OffsVal, dl, N.getValueType()); | ||
|
||
N = DAG.getNode(ISD::ADD, dl, N.getValueType(), N, OffsVal, Flags); | ||
N = DAG.getMemBasePlusOffset(N, OffsVal, dl, Flags); | ||
continue; | ||
} | ||
|
||
|
@@ -4389,7 +4389,7 @@ void SelectionDAGBuilder::visitGetElementPtr(const User &I) { | |
SDNodeFlags AddFlags; | ||
AddFlags.setNoUnsignedWrap(NW.hasNoUnsignedWrap()); | ||
|
||
N = DAG.getNode(ISD::ADD, dl, N.getValueType(), N, IdxN, AddFlags); | ||
N = DAG.getMemBasePlusOffset(N, IdxN, dl, AddFlags); | ||
} | ||
} | ||
|
||
|
@@ -9138,8 +9138,8 @@ bool SelectionDAGBuilder::visitMemPCpyCall(const CallInst &I) { | |
Size = DAG.getSExtOrTrunc(Size, sdl, Dst.getValueType()); | ||
|
||
// Adjust return pointer to point just past the last dst byte. | ||
SDValue DstPlusSize = DAG.getNode(ISD::ADD, sdl, Dst.getValueType(), | ||
Dst, Size); | ||
SDNodeFlags Flags; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't the Flags argument of getMemBasePlusOffset have a default value? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, I've now removed the unnecessary explicit argument setting here, thanks! I think we could actually use NUW here since this operation computes the position one-past-the-end of a memcpy'd memory range (which should either be within or one-past-the-end of an allocated object, which may not wrap according to the IR LangRef), but let's not add more functionality changes to this PR. |
||
SDValue DstPlusSize = DAG.getMemBasePlusOffset(Dst, Size, sdl, Flags); | ||
setValue(&I, DstPlusSize); | ||
return true; | ||
} | ||
|
@@ -11230,10 +11230,9 @@ TargetLowering::LowerCallTo(TargetLowering::CallLoweringInfo &CLI) const { | |
MachineFunction &MF = CLI.DAG.getMachineFunction(); | ||
Align HiddenSRetAlign = MF.getFrameInfo().getObjectAlign(DemoteStackIdx); | ||
for (unsigned i = 0; i < NumValues; ++i) { | ||
SDValue Add = | ||
CLI.DAG.getNode(ISD::ADD, CLI.DL, PtrVT, DemoteStackSlot, | ||
CLI.DAG.getConstant(Offsets[i], CLI.DL, PtrVT), | ||
SDNodeFlags::NoUnsignedWrap); | ||
SDValue Add = CLI.DAG.getMemBasePlusOffset( | ||
DemoteStackSlot, CLI.DAG.getConstant(Offsets[i], CLI.DL, PtrVT), | ||
CLI.DL, SDNodeFlags::NoUnsignedWrap); | ||
SDValue L = CLI.DAG.getLoad( | ||
RetTys[i], CLI.DL, CLI.Chain, Add, | ||
MachinePointerInfo::getFixedStack(CLI.DAG.getMachineFunction(), | ||
|
Uh oh!
There was an error while loading. Please reload this page.