Skip to content

Commit 8e7f1be

Browse files
authored
[clang][RISCV] Remove unneeded RISCV tuple code (llvm#121024)
These code are no longer needed because we've modeled tuple type using target extension type rather than structure of scalable vectors.
1 parent 6d7cf52 commit 8e7f1be

File tree

2 files changed

+1
-38
lines changed

2 files changed

+1
-38
lines changed

clang/lib/CodeGen/CGCall.cpp

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3235,22 +3235,6 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
32353235

32363236
llvm::StructType *STy =
32373237
dyn_cast<llvm::StructType>(ArgI.getCoerceToType());
3238-
if (ArgI.isDirect() && !ArgI.getCanBeFlattened() && STy &&
3239-
STy->getNumElements() > 1) {
3240-
[[maybe_unused]] llvm::TypeSize StructSize =
3241-
CGM.getDataLayout().getTypeAllocSize(STy);
3242-
[[maybe_unused]] llvm::TypeSize PtrElementSize =
3243-
CGM.getDataLayout().getTypeAllocSize(ConvertTypeForMem(Ty));
3244-
if (STy->containsHomogeneousScalableVectorTypes()) {
3245-
assert(StructSize == PtrElementSize &&
3246-
"Only allow non-fractional movement of structure with"
3247-
"homogeneous scalable vector type");
3248-
3249-
ArgVals.push_back(ParamValue::forDirect(AI));
3250-
break;
3251-
}
3252-
}
3253-
32543238
Address Alloca = CreateMemTemp(Ty, getContext().getDeclAlign(Arg),
32553239
Arg->getName());
32563240

@@ -5414,21 +5398,6 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
54145398

54155399
llvm::StructType *STy =
54165400
dyn_cast<llvm::StructType>(ArgInfo.getCoerceToType());
5417-
if (STy && ArgInfo.isDirect() && !ArgInfo.getCanBeFlattened()) {
5418-
llvm::Type *SrcTy = ConvertTypeForMem(I->Ty);
5419-
[[maybe_unused]] llvm::TypeSize SrcTypeSize =
5420-
CGM.getDataLayout().getTypeAllocSize(SrcTy);
5421-
[[maybe_unused]] llvm::TypeSize DstTypeSize =
5422-
CGM.getDataLayout().getTypeAllocSize(STy);
5423-
if (STy->containsHomogeneousScalableVectorTypes()) {
5424-
assert(SrcTypeSize == DstTypeSize &&
5425-
"Only allow non-fractional movement of structure with "
5426-
"homogeneous scalable vector type");
5427-
5428-
IRCallArgs[FirstIRArg] = I->getKnownRValue().getScalarVal();
5429-
break;
5430-
}
5431-
}
54325401

54335402
// FIXME: Avoid the conversion through memory if possible.
54345403
Address Src = Address::invalid();

clang/lib/CodeGen/Targets/RISCV.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -495,13 +495,7 @@ ABIArgInfo RISCVABIInfo::classifyArgumentType(QualType Ty, bool IsFixed,
495495
return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
496496
}
497497

498-
ABIArgInfo Info = ABIArgInfo::getDirect();
499-
500-
// If it is tuple type, it can't be flattened.
501-
if (llvm::StructType *STy = dyn_cast<llvm::StructType>(CGT.ConvertType(Ty)))
502-
Info.setCanBeFlattened(!STy->containsHomogeneousScalableVectorTypes());
503-
504-
return Info;
498+
return ABIArgInfo::getDirect();
505499
}
506500

507501
if (const VectorType *VT = Ty->getAs<VectorType>())

0 commit comments

Comments
 (0)