-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[GISel] Remove unused DataLayout operand from getApproximateEVTForLLT #119833
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
|
@llvm/pr-subscribers-llvm-globalisel Author: Craig Topper (topperc) ChangesFull diff: https://github.com/llvm/llvm-project/pull/119833.diff 7 Files Affected:
diff --git a/llvm/include/llvm/CodeGen/LowLevelTypeUtils.h b/llvm/include/llvm/CodeGen/LowLevelTypeUtils.h
index 7d99b7731767be..142e5cd4e7ad17 100644
--- a/llvm/include/llvm/CodeGen/LowLevelTypeUtils.h
+++ b/llvm/include/llvm/CodeGen/LowLevelTypeUtils.h
@@ -31,7 +31,7 @@ LLT getLLTForType(Type &Ty, const DataLayout &DL);
/// Get a rough equivalent of an MVT for a given LLT. MVT can't distinguish
/// pointers, so these will convert to a plain integer.
MVT getMVTForLLT(LLT Ty);
-EVT getApproximateEVTForLLT(LLT Ty, const DataLayout &DL, LLVMContext &Ctx);
+EVT getApproximateEVTForLLT(LLT Ty, LLVMContext &Ctx);
/// Get a rough equivalent of an LLT for a given MVT. LLT does not yet support
/// scalarable vector types, and will assert if used.
diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index aaab209bfa75d6..3751aac4df8ead 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -2979,10 +2979,9 @@ class TargetLoweringBase {
}
virtual bool isTruncateFree(EVT FromVT, EVT ToVT) const { return false; }
- virtual bool isTruncateFree(LLT FromTy, LLT ToTy, const DataLayout &DL,
- LLVMContext &Ctx) const {
- return isTruncateFree(getApproximateEVTForLLT(FromTy, DL, Ctx),
- getApproximateEVTForLLT(ToTy, DL, Ctx));
+ virtual bool isTruncateFree(LLT FromTy, LLT ToTy, LLVMContext &Ctx) const {
+ return isTruncateFree(getApproximateEVTForLLT(FromTy, Ctx),
+ getApproximateEVTForLLT(ToTy, Ctx));
}
/// Return true if truncating the specific node Val to type VT2 is free.
@@ -3065,10 +3064,9 @@ class TargetLoweringBase {
}
virtual bool isZExtFree(EVT FromTy, EVT ToTy) const { return false; }
- virtual bool isZExtFree(LLT FromTy, LLT ToTy, const DataLayout &DL,
- LLVMContext &Ctx) const {
- return isZExtFree(getApproximateEVTForLLT(FromTy, DL, Ctx),
- getApproximateEVTForLLT(ToTy, DL, Ctx));
+ virtual bool isZExtFree(LLT FromTy, LLT ToTy, LLVMContext &Ctx) const {
+ return isZExtFree(getApproximateEVTForLLT(FromTy, Ctx),
+ getApproximateEVTForLLT(ToTy, Ctx));
}
/// Return true if zero-extending the specific node Val to type VT2 is free
diff --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
index a2737995446526..bbeb748f770b53 100644
--- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
@@ -3122,7 +3122,6 @@ bool CombinerHelper::matchHoistLogicOpWithSameOpcodeHands(
case TargetOpcode::G_TRUNC: {
// Match: logic (trunc X), (trunc Y) -> trunc (logic X, Y)
const MachineFunction *MF = MI.getMF();
- const DataLayout &DL = MF->getDataLayout();
LLVMContext &Ctx = MF->getFunction().getContext();
LLT DstTy = MRI.getType(Dst);
@@ -3130,8 +3129,7 @@ bool CombinerHelper::matchHoistLogicOpWithSameOpcodeHands(
// Be extra careful sinking truncate. If it's free, there's no benefit in
// widening a binop.
- if (TLI.isZExtFree(DstTy, XTy, DL, Ctx) &&
- TLI.isTruncateFree(XTy, DstTy, DL, Ctx))
+ if (TLI.isZExtFree(DstTy, XTy, Ctx) && TLI.isTruncateFree(XTy, DstTy, Ctx))
return false;
break;
}
@@ -5072,9 +5070,8 @@ bool CombinerHelper::matchNarrowBinopFeedingAnd(
auto &MF = *MI.getMF();
const auto &TLI = getTargetLowering();
LLVMContext &Ctx = MF.getFunction().getContext();
- auto &DL = MF.getDataLayout();
- if (!TLI.isTruncateFree(WideTy, NarrowTy, DL, Ctx) ||
- !TLI.isZExtFree(NarrowTy, WideTy, DL, Ctx))
+ if (!TLI.isTruncateFree(WideTy, NarrowTy, Ctx) ||
+ !TLI.isZExtFree(NarrowTy, WideTy, Ctx))
return false;
if (!isLegalOrBeforeLegalizer({TargetOpcode::G_TRUNC, {NarrowTy, WideTy}}) ||
!isLegalOrBeforeLegalizer({TargetOpcode::G_ZEXT, {WideTy, NarrowTy}}))
@@ -5378,8 +5375,7 @@ bool CombinerHelper::matchUDivByConst(MachineInstr &MI) {
AttributeList Attr = MF.getFunction().getAttributes();
const auto &TLI = getTargetLowering();
LLVMContext &Ctx = MF.getFunction().getContext();
- auto &DL = MF.getDataLayout();
- if (TLI.isIntDivCheap(getApproximateEVTForLLT(DstTy, DL, Ctx), Attr))
+ if (TLI.isIntDivCheap(getApproximateEVTForLLT(DstTy, Ctx), Attr))
return false;
// Don't do this for minsize because the instruction sequence is usually
@@ -5428,8 +5424,7 @@ bool CombinerHelper::matchSDivByConst(MachineInstr &MI) {
AttributeList Attr = MF.getFunction().getAttributes();
const auto &TLI = getTargetLowering();
LLVMContext &Ctx = MF.getFunction().getContext();
- auto &DL = MF.getDataLayout();
- if (TLI.isIntDivCheap(getApproximateEVTForLLT(DstTy, DL, Ctx), Attr))
+ if (TLI.isIntDivCheap(getApproximateEVTForLLT(DstTy, Ctx), Attr))
return false;
// Don't do this for minsize because the instruction sequence is usually
diff --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelperCasts.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelperCasts.cpp
index 30557e6a2304e6..09815e85ea859b 100644
--- a/llvm/lib/CodeGen/GlobalISel/CombinerHelperCasts.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelperCasts.cpp
@@ -170,9 +170,9 @@ bool CombinerHelper::isCastFree(unsigned Opcode, LLT ToTy, LLT FromTy) const {
switch (Opcode) {
case TargetOpcode::G_ANYEXT:
case TargetOpcode::G_ZEXT:
- return TLI.isZExtFree(FromTy, ToTy, DL, Ctx);
+ return TLI.isZExtFree(FromTy, ToTy, Ctx);
case TargetOpcode::G_TRUNC:
- return TLI.isTruncateFree(FromTy, ToTy, DL, Ctx);
+ return TLI.isTruncateFree(FromTy, ToTy, Ctx);
default:
return false;
}
diff --git a/llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp b/llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp
index e411e73dbe7340..08d30db0ca8987 100644
--- a/llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp
@@ -327,7 +327,7 @@ bool LoadStoreOpt::mergeStores(SmallVectorImpl<GStore *> &StoresToMerge) {
for (MergeSizeBits = MaxSizeBits; MergeSizeBits > 1; MergeSizeBits /= 2) {
LLT StoreTy = LLT::scalar(MergeSizeBits);
EVT StoreEVT =
- getApproximateEVTForLLT(StoreTy, DL, MF->getFunction().getContext());
+ getApproximateEVTForLLT(StoreTy, MF->getFunction().getContext());
if (LegalSizes.size() > MergeSizeBits && LegalSizes[MergeSizeBits] &&
TLI->canMergeStoresTo(AS, StoreEVT, *MF) &&
(TLI->isTypeLegal(StoreEVT)))
diff --git a/llvm/lib/CodeGen/LowLevelTypeUtils.cpp b/llvm/lib/CodeGen/LowLevelTypeUtils.cpp
index 1602cd99c383c6..936c9fbb2fff02 100644
--- a/llvm/lib/CodeGen/LowLevelTypeUtils.cpp
+++ b/llvm/lib/CodeGen/LowLevelTypeUtils.cpp
@@ -54,10 +54,9 @@ MVT llvm::getMVTForLLT(LLT Ty) {
Ty.getElementCount());
}
-EVT llvm::getApproximateEVTForLLT(LLT Ty, const DataLayout &DL,
- LLVMContext &Ctx) {
+EVT llvm::getApproximateEVTForLLT(LLT Ty, LLVMContext &Ctx) {
if (Ty.isVector()) {
- EVT EltVT = getApproximateEVTForLLT(Ty.getElementType(), DL, Ctx);
+ EVT EltVT = getApproximateEVTForLLT(Ty.getElementType(), Ctx);
return EVT::getVectorVT(Ctx, EltVT, Ty.getElementCount());
}
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 9dc2701654b8b9..3b0e9c7526fd0a 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -1750,7 +1750,7 @@ bool TargetLoweringBase::allowsMemoryAccess(LLVMContext &Context,
const DataLayout &DL, LLT Ty,
const MachineMemOperand &MMO,
unsigned *Fast) const {
- EVT VT = getApproximateEVTForLLT(Ty, DL, Context);
+ EVT VT = getApproximateEVTForLLT(Ty, Context);
return allowsMemoryAccess(Context, DL, VT, MMO.getAddrSpace(), MMO.getAlign(),
MMO.getFlags(), Fast);
}
|
arsenm
approved these changes
Dec 13, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.