aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2021-12-23 13:00:46 +0100
committerNikita Popov <npopov@redhat.com>2021-12-23 13:02:49 +0100
commit53f0538181fd62f2a5efa9c73589f75e80454a8e (patch)
tree5c1c0bf107d8832149cd33dc7f376fc9bf9dca49 /clang/lib
parent1d50cf98b56fd17e675eb990572befbc440bceab (diff)
downloadllvm-53f0538181fd62f2a5efa9c73589f75e80454a8e.zip
llvm-53f0538181fd62f2a5efa9c73589f75e80454a8e.tar.gz
llvm-53f0538181fd62f2a5efa9c73589f75e80454a8e.tar.bz2
[CodeGen] Use correct element type for store to sret
sret is special in that it does not use the memory type representation. Manually construct the LValue using ConvertType instead of ConvertTypeForMem here. This fixes matrix-lowering-opt-levels.c on s390x.
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index b202326..d70f78f 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -3469,12 +3469,19 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI,
case TEK_Aggregate:
// Do nothing; aggregrates get evaluated directly into the destination.
break;
- case TEK_Scalar:
- EmitStoreOfScalar(Builder.CreateLoad(ReturnValue),
- MakeNaturalAlignAddrLValue(&*AI, RetTy),
- /*isInit*/ true);
+ case TEK_Scalar: {
+ LValueBaseInfo BaseInfo;
+ TBAAAccessInfo TBAAInfo;
+ CharUnits Alignment =
+ CGM.getNaturalTypeAlignment(RetTy, &BaseInfo, &TBAAInfo);
+ Address ArgAddr(&*AI, ConvertType(RetTy), Alignment);
+ LValue ArgVal =
+ LValue::MakeAddr(ArgAddr, RetTy, getContext(), BaseInfo, TBAAInfo);
+ EmitStoreOfScalar(
+ Builder.CreateLoad(ReturnValue), ArgVal, /*isInit*/ true);
break;
}
+ }
break;
}