-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[clang] fix emitvaarg when struct is null #72624
base: main
Are you sure you want to change the base?
Conversation
Fix bug when emit null struct with attribute aligned(16) and ICE of debugbuild.
@llvm/pr-subscribers-backend-aarch64 @llvm/pr-subscribers-clang-codegen Author: Jolyon (Jolyon0202) ChangesFix bug when emit null struct with attribute aligned(16) and ICE of debugbuild. Full diff: https://github.com/llvm/llvm-project/pull/72624.diff 1 Files Affected:
diff --git a/clang/lib/CodeGen/Targets/AArch64.cpp b/clang/lib/CodeGen/Targets/AArch64.cpp
index be5145daa00b7f5..49dff102b7d554a 100644
--- a/clang/lib/CodeGen/Targets/AArch64.cpp
+++ b/clang/lib/CodeGen/Targets/AArch64.cpp
@@ -526,7 +526,7 @@ Address AArch64ABIInfo::EmitAAPCSVAArg(Address VAListAddr, QualType Ty,
llvm::Type *BaseTy = CGF.ConvertType(Ty);
if (IsIndirect)
BaseTy = llvm::PointerType::getUnqual(BaseTy);
- else if (AI.getCoerceToType())
+ else if (AI.canHaveCoerceToType() && AI.getCoerceToType())
BaseTy = AI.getCoerceToType();
unsigned NumRegs = 1;
@@ -594,7 +594,7 @@ Address AArch64ABIInfo::EmitAAPCSVAArg(Address VAListAddr, QualType Ty,
// Integer arguments may need to correct register alignment (for example a
// "struct { __int128 a; };" gets passed in x_2N, x_{2N+1}). In this case we
// align __gr_offs to calculate the potential address.
- if (!IsFPR && !IsIndirect && TyAlign.getQuantity() > 8) {
+ if (!IsFPR && !IsIndirect && TyAlign.getQuantity() > 8 && !TySize.isZero()) {
int Align = TyAlign.getQuantity();
reg_offs = CGF.Builder.CreateAdd(
|
demo:
found two bug need to fix: |
Please fix the pull request description to say this is aarch64-specific. Missing regression test in clang/test/CodeGen/ How does this interact with #72197? |
Fix bug when emit null struct with attribute aligned(16) and ICE of debugbuild.