[llvm-branch-commits] [llvm] 2ad55ed - [NFC][SelectionDAGBuilder] Use getObjectPtrOffset in place of discrete nodes.
Tobias Hieta via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Aug 18 00:53:17 PDT 2023
Author: Paul Walker
Date: 2023-08-18T09:50:57+02:00
New Revision: 2ad55edf7181e96e4caa12add7949f7b1f98ee1c
URL: https://github.com/llvm/llvm-project/commit/2ad55edf7181e96e4caa12add7949f7b1f98ee1c
DIFF: https://github.com/llvm/llvm-project/commit/2ad55edf7181e96e4caa12add7949f7b1f98ee1c.diff
LOG: [NFC][SelectionDAGBuilder] Use getObjectPtrOffset in place of discrete nodes.
Some prep work to make aggregate loads and stores TypeSize aware.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index dcfad7d9d92ab1..d3882372efcdb1 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -4231,14 +4231,8 @@ void SelectionDAGBuilder::visitLoad(const LoadInst &I) {
if (isVolatile)
Root = TLI.prepareVolatileOrAtomicLoad(Root, dl, DAG);
- // An aggregate load cannot wrap around the address space, so offsets to its
- // parts don't wrap either.
- SDNodeFlags Flags;
- Flags.setNoUnsignedWrap(true);
-
SmallVector<SDValue, 4> Values(NumValues);
SmallVector<SDValue, 4> Chains(std::min(MaxParallelChains, NumValues));
- EVT PtrVT = Ptr.getValueType();
unsigned ChainI = 0;
for (unsigned i = 0; i != NumValues; ++i, ++ChainI) {
@@ -4255,11 +4249,8 @@ void SelectionDAGBuilder::visitLoad(const LoadInst &I) {
Root = Chain;
ChainI = 0;
}
- SDValue A = DAG.getNode(ISD::ADD, dl,
- PtrVT, Ptr,
- DAG.getConstant(Offsets[i], dl, PtrVT),
- Flags);
+ SDValue A = DAG.getObjectPtrOffset(dl, Ptr, TypeSize::Fixed(Offsets[i]));
SDValue L = DAG.getLoad(MemVTs[i], dl, Root, A,
MachinePointerInfo(SV, Offsets[i]), Alignment,
MMOFlags, AAInfo, Ranges);
@@ -4384,11 +4375,6 @@ void SelectionDAGBuilder::visitStore(const StoreInst &I) {
auto MMOFlags = TLI.getStoreMemOperandFlags(I, DAG.getDataLayout());
- // An aggregate load cannot wrap around the address space, so offsets to its
- // parts don't wrap either.
- SDNodeFlags Flags;
- Flags.setNoUnsignedWrap(true);
-
unsigned ChainI = 0;
for (unsigned i = 0; i != NumValues; ++i, ++ChainI) {
// See visitLoad comments.
@@ -4398,8 +4384,8 @@ void SelectionDAGBuilder::visitStore(const StoreInst &I) {
Root = Chain;
ChainI = 0;
}
- SDValue Add =
- DAG.getMemBasePlusOffset(Ptr, TypeSize::Fixed(Offsets[i]), dl, Flags);
+
+ SDValue Add = DAG.getObjectPtrOffset(dl, Ptr, TypeSize::Fixed(Offsets[i]));
SDValue Val = SDValue(Src.getNode(), Src.getResNo() + i);
if (MemVTs[i] != ValueVTs[i])
Val = DAG.getPtrExtOrTrunc(Val, dl, MemVTs[i]);
More information about the llvm-branch-commits
mailing list