-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang][RISCV] Remove unneeded RISCV tuple code #121024
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
Conversation
These code are no longer needed because we've modeled tuple type using target extension type rather than structure of scalable vectors.
@llvm/pr-subscribers-clang-codegen @llvm/pr-subscribers-backend-risc-v Author: Brandon Wu (4vtomat) ChangesThese code are no longer needed because we've modeled tuple type using Full diff: https://github.com/llvm/llvm-project/pull/121024.diff 2 Files Affected:
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 50b9dfbbab083a..f139c30f3dfd44 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -3235,22 +3235,6 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
llvm::StructType *STy =
dyn_cast<llvm::StructType>(ArgI.getCoerceToType());
- if (ArgI.isDirect() && !ArgI.getCanBeFlattened() && STy &&
- STy->getNumElements() > 1) {
- [[maybe_unused]] llvm::TypeSize StructSize =
- CGM.getDataLayout().getTypeAllocSize(STy);
- [[maybe_unused]] llvm::TypeSize PtrElementSize =
- CGM.getDataLayout().getTypeAllocSize(ConvertTypeForMem(Ty));
- if (STy->containsHomogeneousScalableVectorTypes()) {
- assert(StructSize == PtrElementSize &&
- "Only allow non-fractional movement of structure with"
- "homogeneous scalable vector type");
-
- ArgVals.push_back(ParamValue::forDirect(AI));
- break;
- }
- }
-
Address Alloca = CreateMemTemp(Ty, getContext().getDeclAlign(Arg),
Arg->getName());
@@ -5414,21 +5398,6 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
llvm::StructType *STy =
dyn_cast<llvm::StructType>(ArgInfo.getCoerceToType());
- if (STy && ArgInfo.isDirect() && !ArgInfo.getCanBeFlattened()) {
- llvm::Type *SrcTy = ConvertTypeForMem(I->Ty);
- [[maybe_unused]] llvm::TypeSize SrcTypeSize =
- CGM.getDataLayout().getTypeAllocSize(SrcTy);
- [[maybe_unused]] llvm::TypeSize DstTypeSize =
- CGM.getDataLayout().getTypeAllocSize(STy);
- if (STy->containsHomogeneousScalableVectorTypes()) {
- assert(SrcTypeSize == DstTypeSize &&
- "Only allow non-fractional movement of structure with "
- "homogeneous scalable vector type");
-
- IRCallArgs[FirstIRArg] = I->getKnownRValue().getScalarVal();
- break;
- }
- }
// FIXME: Avoid the conversion through memory if possible.
Address Src = Address::invalid();
diff --git a/clang/lib/CodeGen/Targets/RISCV.cpp b/clang/lib/CodeGen/Targets/RISCV.cpp
index b04e436c665f52..873e696e1328f9 100644
--- a/clang/lib/CodeGen/Targets/RISCV.cpp
+++ b/clang/lib/CodeGen/Targets/RISCV.cpp
@@ -495,13 +495,7 @@ ABIArgInfo RISCVABIInfo::classifyArgumentType(QualType Ty, bool IsFixed,
return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
}
- ABIArgInfo Info = ABIArgInfo::getDirect();
-
- // If it is tuple type, it can't be flattened.
- if (llvm::StructType *STy = dyn_cast<llvm::StructType>(CGT.ConvertType(Ty)))
- Info.setCanBeFlattened(!STy->containsHomogeneousScalableVectorTypes());
-
- return Info;
+ return ABIArgInfo::getDirect();
}
if (const VectorType *VT = Ty->getAs<VectorType>())
|
@llvm/pr-subscribers-clang Author: Brandon Wu (4vtomat) ChangesThese code are no longer needed because we've modeled tuple type using Full diff: https://github.com/llvm/llvm-project/pull/121024.diff 2 Files Affected:
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 50b9dfbbab083a..f139c30f3dfd44 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -3235,22 +3235,6 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
llvm::StructType *STy =
dyn_cast<llvm::StructType>(ArgI.getCoerceToType());
- if (ArgI.isDirect() && !ArgI.getCanBeFlattened() && STy &&
- STy->getNumElements() > 1) {
- [[maybe_unused]] llvm::TypeSize StructSize =
- CGM.getDataLayout().getTypeAllocSize(STy);
- [[maybe_unused]] llvm::TypeSize PtrElementSize =
- CGM.getDataLayout().getTypeAllocSize(ConvertTypeForMem(Ty));
- if (STy->containsHomogeneousScalableVectorTypes()) {
- assert(StructSize == PtrElementSize &&
- "Only allow non-fractional movement of structure with"
- "homogeneous scalable vector type");
-
- ArgVals.push_back(ParamValue::forDirect(AI));
- break;
- }
- }
-
Address Alloca = CreateMemTemp(Ty, getContext().getDeclAlign(Arg),
Arg->getName());
@@ -5414,21 +5398,6 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
llvm::StructType *STy =
dyn_cast<llvm::StructType>(ArgInfo.getCoerceToType());
- if (STy && ArgInfo.isDirect() && !ArgInfo.getCanBeFlattened()) {
- llvm::Type *SrcTy = ConvertTypeForMem(I->Ty);
- [[maybe_unused]] llvm::TypeSize SrcTypeSize =
- CGM.getDataLayout().getTypeAllocSize(SrcTy);
- [[maybe_unused]] llvm::TypeSize DstTypeSize =
- CGM.getDataLayout().getTypeAllocSize(STy);
- if (STy->containsHomogeneousScalableVectorTypes()) {
- assert(SrcTypeSize == DstTypeSize &&
- "Only allow non-fractional movement of structure with "
- "homogeneous scalable vector type");
-
- IRCallArgs[FirstIRArg] = I->getKnownRValue().getScalarVal();
- break;
- }
- }
// FIXME: Avoid the conversion through memory if possible.
Address Src = Address::invalid();
diff --git a/clang/lib/CodeGen/Targets/RISCV.cpp b/clang/lib/CodeGen/Targets/RISCV.cpp
index b04e436c665f52..873e696e1328f9 100644
--- a/clang/lib/CodeGen/Targets/RISCV.cpp
+++ b/clang/lib/CodeGen/Targets/RISCV.cpp
@@ -495,13 +495,7 @@ ABIArgInfo RISCVABIInfo::classifyArgumentType(QualType Ty, bool IsFixed,
return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
}
- ABIArgInfo Info = ABIArgInfo::getDirect();
-
- // If it is tuple type, it can't be flattened.
- if (llvm::StructType *STy = dyn_cast<llvm::StructType>(CGT.ConvertType(Ty)))
- Info.setCanBeFlattened(!STy->containsHomogeneousScalableVectorTypes());
-
- return Info;
+ return ABIArgInfo::getDirect();
}
if (const VectorType *VT = Ty->getAs<VectorType>())
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Nice cleanup.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/42/builds/2501 Here is the relevant piece of the build log for the reference
|
These code are no longer needed because we've modeled tuple type using
target extension type rather than structure of scalable vectors.