[llvm] 4a8665e - SelectionDAG: Avoid some uses of getPointerTy
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 31 15:49:30 PDT 2022
Author: Matt Arsenault
Date: 2022-03-31T18:49:22-04:00
New Revision: 4a8665e23ed875c7f524e1ecd7e8442dc1b6a423
URL: https://github.com/llvm/llvm-project/commit/4a8665e23ed875c7f524e1ecd7e8442dc1b6a423
DIFF: https://github.com/llvm/llvm-project/commit/4a8665e23ed875c7f524e1ecd7e8442dc1b6a423.diff
LOG: SelectionDAG: Avoid some uses of getPointerTy
Avoids use of the default address space parameter, and avoids some
assumptions about the incoming address space.
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 685d7c5e25a66..292692cb626ec 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -216,10 +216,10 @@ static SDValue getCopyFromParts(SelectionDAG &DAG, const SDLoc &DL,
std::swap(Lo, Hi);
EVT TotalVT = EVT::getIntegerVT(*DAG.getContext(), NumParts * PartBits);
Hi = DAG.getNode(ISD::ANY_EXTEND, DL, TotalVT, Hi);
- Hi =
- DAG.getNode(ISD::SHL, DL, TotalVT, Hi,
- DAG.getConstant(Lo.getValueSizeInBits(), DL,
- TLI.getPointerTy(DAG.getDataLayout())));
+ Hi = DAG.getNode(ISD::SHL, DL, TotalVT, Hi,
+ DAG.getConstant(Lo.getValueSizeInBits(), DL,
+ TLI.getShiftAmountTy(
+ TotalVT, DAG.getDataLayout())));
Lo = DAG.getNode(ISD::ZERO_EXTEND, DL, TotalVT, Lo);
Val = DAG.getNode(ISD::OR, DL, TotalVT, Lo, Hi);
}
@@ -4876,7 +4876,8 @@ static SDValue GetExponent(SelectionDAG &DAG, SDValue Op,
DAG.getConstant(0x7f800000, dl, MVT::i32));
SDValue t1 = DAG.getNode(
ISD::SRL, dl, MVT::i32, t0,
- DAG.getConstant(23, dl, TLI.getPointerTy(DAG.getDataLayout())));
+ DAG.getConstant(23, dl,
+ TLI.getShiftAmountTy(MVT::i32, DAG.getDataLayout())));
SDValue t2 = DAG.getNode(ISD::SUB, dl, MVT::i32, t1,
DAG.getConstant(127, dl, MVT::i32));
return DAG.getNode(ISD::SINT_TO_FP, dl, MVT::f32, t2);
@@ -4901,10 +4902,11 @@ static SDValue getLimitedPrecisionExp2(SDValue t0, const SDLoc &dl,
SDValue X = DAG.getNode(ISD::FSUB, dl, MVT::f32, t0, t1);
// IntegerPartOfX <<= 23;
- IntegerPartOfX = DAG.getNode(
- ISD::SHL, dl, MVT::i32, IntegerPartOfX,
- DAG.getConstant(23, dl, DAG.getTargetLoweringInfo().getPointerTy(
- DAG.getDataLayout())));
+ IntegerPartOfX =
+ DAG.getNode(ISD::SHL, dl, MVT::i32, IntegerPartOfX,
+ DAG.getConstant(23, dl,
+ DAG.getTargetLoweringInfo().getShiftAmountTy(
+ MVT::i32, DAG.getDataLayout())));
SDValue TwoToFractionalPartOfX;
if (LimitFloatPrecision <= 6) {
@@ -5798,16 +5800,18 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
case Intrinsic::vacopy: visitVACopy(I); return;
case Intrinsic::returnaddress:
setValue(&I, DAG.getNode(ISD::RETURNADDR, sdl,
- TLI.getPointerTy(DAG.getDataLayout()),
+ TLI.getValueType(DAG.getDataLayout(), I.getType()),
getValue(I.getArgOperand(0))));
return;
case Intrinsic::addressofreturnaddress:
- setValue(&I, DAG.getNode(ISD::ADDROFRETURNADDR, sdl,
- TLI.getPointerTy(DAG.getDataLayout())));
+ setValue(&I,
+ DAG.getNode(ISD::ADDROFRETURNADDR, sdl,
+ TLI.getValueType(DAG.getDataLayout(), I.getType())));
return;
case Intrinsic::sponentry:
- setValue(&I, DAG.getNode(ISD::SPONENTRY, sdl,
- TLI.getFrameIndexTy(DAG.getDataLayout())));
+ setValue(&I,
+ DAG.getNode(ISD::SPONENTRY, sdl,
+ TLI.getValueType(DAG.getDataLayout(), I.getType())));
return;
case Intrinsic::frameaddress:
setValue(&I, DAG.getNode(ISD::FRAMEADDR, sdl,
@@ -6847,7 +6851,8 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
}
case Intrinsic::invariant_start:
// Discard region information.
- setValue(&I, DAG.getUNDEF(TLI.getPointerTy(DAG.getDataLayout())));
+ setValue(&I,
+ DAG.getUNDEF(TLI.getValueType(DAG.getDataLayout(), I.getType())));
return;
case Intrinsic::invariant_end:
// Discard region information.
More information about the llvm-commits
mailing list