@@ -2095,24 +2095,11 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
2095
2095
isa<llvm::ScalableVectorType>(DstTy)) ||
2096
2096
(isa<llvm::ScalableVectorType>(SrcTy) &&
2097
2097
isa<llvm::FixedVectorType>(DstTy))) {
2098
- if (const CallExpr *CE = dyn_cast<CallExpr>(E)) {
2099
- // Call expressions can't have a scalar return unless the return type
2100
- // is a reference type so an lvalue can't be emitted. Create a temp
2101
- // alloca to store the call, bitcast the address then load.
2102
- QualType RetTy = CE->getCallReturnType (CGF.getContext ());
2103
- Address Addr =
2104
- CGF.CreateDefaultAlignTempAlloca (SrcTy, " saved-call-rvalue" );
2105
- LValue LV = CGF.MakeAddrLValue (Addr, RetTy);
2106
- CGF.EmitStoreOfScalar (Src, LV);
2107
- Addr = Builder.CreateElementBitCast (Addr, CGF.ConvertTypeForMem (DestTy),
2108
- " castFixedSve" );
2109
- LValue DestLV = CGF.MakeAddrLValue (Addr, DestTy);
2110
- DestLV.setTBAAInfo (TBAAAccessInfo::getMayAliasInfo ());
2111
- return EmitLoadOfLValue (DestLV, CE->getExprLoc ());
2112
- }
2113
-
2114
- Address Addr = EmitLValue (E).getAddress (CGF);
2115
- Addr = Builder.CreateElementBitCast (Addr, CGF.ConvertTypeForMem (DestTy));
2098
+ Address Addr = CGF.CreateDefaultAlignTempAlloca (SrcTy, " saved-value" );
2099
+ LValue LV = CGF.MakeAddrLValue (Addr, E->getType ());
2100
+ CGF.EmitStoreOfScalar (Src, LV);
2101
+ Addr = Builder.CreateElementBitCast (Addr, CGF.ConvertTypeForMem (DestTy),
2102
+ " castFixedSve" );
2116
2103
LValue DestLV = CGF.MakeAddrLValue (Addr, DestTy);
2117
2104
DestLV.setTBAAInfo (TBAAAccessInfo::getMayAliasInfo ());
2118
2105
return EmitLoadOfLValue (DestLV, CE->getExprLoc ());
0 commit comments