[clang] Revert "[clang] remove lots of "innocuous" addrspacecasts" (PR #199685)
via cfe-commits
cfe-commits at lists.llvm.org
Tue May 26 07:01:56 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-codegen
Author: Jan Patrick Lehr (jplehr)
<details>
<summary>Changes</summary>
Reverts llvm/llvm-project#<!-- -->197745
Broke AMDGPU HIP Kokkos bot: https://lab.llvm.org/buildbot/#/builders/230/builds/958
Late reply as the breakage got lost in some trouble with the buildbot fleet.
---
Patch is 461.20 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/199685.diff
40 Files Affected:
- (modified) clang/lib/CodeGen/ABIInfoImpl.cpp (+1-1)
- (modified) clang/lib/CodeGen/CGAtomic.cpp (+4-4)
- (modified) clang/lib/CodeGen/CGBlocks.cpp (+3-4)
- (modified) clang/lib/CodeGen/CGBuiltin.cpp (+13-5)
- (modified) clang/lib/CodeGen/CGCUDANV.cpp (+4-4)
- (modified) clang/lib/CodeGen/CGCall.cpp (+18-22)
- (modified) clang/lib/CodeGen/CGClass.cpp (+1-1)
- (modified) clang/lib/CodeGen/CGDecl.cpp (+3-4)
- (modified) clang/lib/CodeGen/CGException.cpp (+2-2)
- (modified) clang/lib/CodeGen/CGExpr.cpp (+3-6)
- (modified) clang/lib/CodeGen/CGExprAgg.cpp (+1-1)
- (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (+11-6)
- (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+12-14)
- (modified) clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp (+2-2)
- (modified) clang/lib/CodeGen/CGStmt.cpp (+1-1)
- (modified) clang/lib/CodeGen/CGStmtOpenMP.cpp (+12-12)
- (modified) clang/lib/CodeGen/CodeGenFunction.h (+3-6)
- (modified) clang/lib/CodeGen/MicrosoftCXXABI.cpp (+1-1)
- (modified) clang/lib/CodeGen/TargetBuiltins/ARM.cpp (+2-2)
- (modified) clang/lib/CodeGen/TargetBuiltins/X86.cpp (+2-2)
- (modified) clang/lib/CodeGen/Targets/X86.cpp (+4-4)
- (modified) clang/test/CodeGen/scoped-atomic-ops.c (+852-568)
- (modified) clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu (+103-95)
- (modified) clang/test/CodeGenCUDA/atomic-options.hip (+216-144)
- (modified) clang/test/CodeGenCUDA/builtins-amdgcn.cu (+27-18)
- (modified) clang/test/CodeGenCUDA/builtins-spirv-amdgcn.cu (+54-36)
- (modified) clang/test/CodeGenCUDA/record-layout.cu (+4-3)
- (modified) clang/test/CodeGenCXX/amdgcn-func-arg.cpp (+41-60)
- (modified) clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp (+2-3)
- (modified) clang/test/CodeGenHIP/placement-new-addrspace.hip (+3-2)
- (modified) clang/test/CodeGenOpenCL/addr-space-struct-arg.cl (+12-8)
- (modified) clang/test/CodeGenOpenCL/amdgpu-abi-struct-arg-byref.cl (+12-8)
- (modified) clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl (+2)
- (modified) clang/test/CodeGenOpenCL/atomic-ops.cl (+3-2)
- (modified) clang/test/CodeGenSYCL/kernel-caller-entry-point.cpp (+35-34)
- (modified) clang/test/OpenMP/amdgcn_target_device_vla.cpp (+24-19)
- (modified) clang/test/OpenMP/amdgpu_target_with_aligned_attribute.c (+9-7)
- (modified) clang/test/OpenMP/target_teams_generic_loop_codegen.cpp (+9-7)
- (modified) clang/test/OpenMP/target_teams_generic_loop_codegen_as_distribute.cpp (+6-5)
- (modified) clang/test/OpenMP/target_teams_generic_loop_codegen_as_parallel_for.cpp (+42-32)
``````````diff
diff --git a/clang/lib/CodeGen/ABIInfoImpl.cpp b/clang/lib/CodeGen/ABIInfoImpl.cpp
index 887a645a4783a..8ad77ee515d49 100644
--- a/clang/lib/CodeGen/ABIInfoImpl.cpp
+++ b/clang/lib/CodeGen/ABIInfoImpl.cpp
@@ -442,7 +442,7 @@ Address CodeGen::EmitVAArgInstr(CodeGenFunction &CGF, Address VAListAddr,
assert(!AI.getCoerceToType() &&
"Unexpected CoerceToType seen in arginfo in generic VAArg emitter!");
- Address Temp = CGF.CreateMemTempWithoutCast(Ty, "varet");
+ Address Temp = CGF.CreateMemTemp(Ty, "varet");
Val = CGF.Builder.CreateVAArg(VAListAddr.emitRawPointer(CGF),
CGF.ConvertTypeForMem(Ty));
CGF.Builder.CreateStore(Val, Temp);
diff --git a/clang/lib/CodeGen/CGAtomic.cpp b/clang/lib/CodeGen/CGAtomic.cpp
index 270965b109943..b4fd0fdb795aa 100644
--- a/clang/lib/CodeGen/CGAtomic.cpp
+++ b/clang/lib/CodeGen/CGAtomic.cpp
@@ -304,7 +304,7 @@ Address AtomicInfo::CreateTempAlloca() const {
? ValueTy
: AtomicTy.getUnqualifiedType();
Address TempAlloca =
- CGF.CreateMemTempWithoutCast(TmpTy, getAtomicAlignment(), "atomic-temp");
+ CGF.CreateMemTemp(TmpTy, getAtomicAlignment(), "atomic-temp");
// Cast to pointer to value type for bitfields.
if (LVal.isBitField())
return CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
@@ -826,7 +826,7 @@ static void EmitAtomicOp(CodeGenFunction &CGF, AtomicExpr *E, Address Dest,
// into a temporary alloca.
static Address
EmitValToTemp(CodeGenFunction &CGF, Expr *E) {
- Address DeclPtr = CGF.CreateMemTempWithoutCast(E->getType(), ".atomictmp");
+ Address DeclPtr = CGF.CreateMemTemp(E->getType(), ".atomictmp");
CGF.EmitAnyExprToMem(E, DeclPtr, E->getType().getQualifiers(),
/*Init*/ true);
return DeclPtr;
@@ -1025,7 +1025,7 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
CharUnits PointeeIncAmt =
getContext().getTypeSizeInChars(MemTy->getPointeeType());
Val1Scalar = Builder.CreateMul(Val1Scalar, CGM.getSize(PointeeIncAmt));
- auto Temp = CreateMemTempWithoutCast(Val1Ty, ".atomictmp");
+ auto Temp = CreateMemTemp(Val1Ty, ".atomictmp");
Val1 = Temp;
EmitStoreOfScalar(Val1Scalar, MakeAddrLValue(Temp, Val1Ty));
break;
@@ -1121,7 +1121,7 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
if (ShouldCastToIntPtrTy)
Dest = Atomics.castToAtomicIntPointer(Dest);
} else if (E->isCmpXChg())
- Dest = CreateMemTempWithoutCast(RValTy, "cmpxchg.bool");
+ Dest = CreateMemTemp(RValTy, "cmpxchg.bool");
else if (!RValTy->isVoidType()) {
Dest = Atomics.CreateTempAlloca();
if (ShouldCastToIntPtrTy)
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp
index 0683a4937cf37..1ce22df11e6a7 100644
--- a/clang/lib/CodeGen/CGBlocks.cpp
+++ b/clang/lib/CodeGen/CGBlocks.cpp
@@ -1418,8 +1418,7 @@ void CodeGenFunction::setBlockContextParameter(const ImplicitParamDecl *D,
// Allocate a stack slot like for any local variable to guarantee optimal
// debug info at -O0. The mem2reg pass will eliminate it when optimizing.
- RawAddress alloc =
- CreateMemTempWithoutCast(D->getType(), D->getName() + ".addr");
+ RawAddress alloc = CreateMemTemp(D->getType(), D->getName() + ".addr");
Builder.CreateStore(arg, alloc);
if (CGDebugInfo *DI = getDebugInfo()) {
if (CGM.getCodeGenOpts().hasReducedDebugInfo()) {
@@ -1558,8 +1557,8 @@ llvm::Function *CodeGenFunction::GenerateBlockFunction(
if (!capture.isConstant()) continue;
CharUnits align = getContext().getDeclAlign(variable);
- Address alloca = CreateMemTempWithoutCast(variable->getType(), align,
- "block.captured-const");
+ Address alloca =
+ CreateMemTemp(variable->getType(), align, "block.captured-const");
Builder.CreateStore(capture.getConstant(), alloca);
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index b1d727cb5e0ad..4a59c6560ef26 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -2271,9 +2271,10 @@ RValue CodeGenFunction::emitBuiltinOSLogFormat(const CallExpr &E) {
if (!isa<Constant>(ArgVal)) {
CleanupKind Cleanup = getARCCleanupKind();
QualType Ty = TheExpr->getType();
- RawAddress Alloca = CreateMemTempWithoutCast(Ty, "os.log.arg");
+ RawAddress Alloca = RawAddress::invalid();
+ RawAddress Addr = CreateMemTemp(Ty, "os.log.arg", &Alloca);
ArgVal = EmitARCRetain(Ty, ArgVal);
- Builder.CreateStore(ArgVal, Alloca);
+ Builder.CreateStore(ArgVal, Addr);
pushLifetimeExtendedDestroy(Cleanup, Alloca, Ty,
CodeGenFunction::destroyARCStrongPrecise,
Cleanup & EHCleanup);
@@ -6345,8 +6346,13 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
getContext().getSizeType(), ArraySize, nullptr,
ArraySizeModifier::Normal,
/*IndexTypeQuals=*/0);
- auto Tmp = CreateMemTempWithoutCast(SizeArrayTy, "block_sizes");
- llvm::Value *Alloca = Tmp.getPointer();
+ auto Tmp = CreateMemTemp(SizeArrayTy, "block_sizes");
+ llvm::Value *TmpPtr = Tmp.getPointer();
+ // The EmitLifetime* pair expect a naked Alloca as their last argument,
+ // however for cases where the default AS is not the Alloca AS, Tmp is
+ // actually the Alloca ascasted to the default AS, hence the
+ // stripPointerCasts()
+ llvm::Value *Alloca = TmpPtr->stripPointerCasts();
llvm::Value *ElemPtr;
EmitLifetimeStart(Alloca);
// Each of the following arguments specifies the size of the corresponding
@@ -6363,6 +6369,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
Builder.CreateAlignedStore(
V, GEP, CGM.getDataLayout().getPrefTypeAlign(SizeTy));
}
+ // Return the Alloca itself rather than a potential ascast as this is only
+ // used by the paired EmitLifetimeEnd.
return {ElemPtr, Alloca};
};
@@ -6793,7 +6801,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
// always just emit into it.
TypeEvaluationKind EvalKind = getEvaluationKind(E->getType());
if (EvalKind == TEK_Aggregate && ReturnValue.isNull()) {
- Address DestPtr = CreateMemTempWithoutCast(E->getType(), "agg.tmp");
+ Address DestPtr = CreateMemTemp(E->getType(), "agg.tmp");
ReturnValue = ReturnValueSlot(DestPtr, false);
}
diff --git a/clang/lib/CodeGen/CGCUDANV.cpp b/clang/lib/CodeGen/CGCUDANV.cpp
index 259b6c040706b..3eda4237b0549 100644
--- a/clang/lib/CodeGen/CGCUDANV.cpp
+++ b/clang/lib/CodeGen/CGCUDANV.cpp
@@ -433,10 +433,10 @@ void CGNVCUDARuntime::emitDeviceStubBodyNew(CodeGenFunction &CGF,
// Create temporary dim3 grid_dim, block_dim.
ParmVarDecl *GridDimParam = cudaLaunchKernelFD->getParamDecl(1);
QualType Dim3Ty = GridDimParam->getType();
- Address GridDim = CGF.CreateMemTempWithoutCast(
- Dim3Ty, CharUnits::fromQuantity(8), "grid_dim");
- Address BlockDim = CGF.CreateMemTempWithoutCast(
- Dim3Ty, CharUnits::fromQuantity(8), "block_dim");
+ Address GridDim =
+ CGF.CreateMemTemp(Dim3Ty, CharUnits::fromQuantity(8), "grid_dim");
+ Address BlockDim =
+ CGF.CreateMemTemp(Dim3Ty, CharUnits::fromQuantity(8), "block_dim");
Address ShmemSize = CGF.CreateTempAlloca(SizeTy, LangAS::Default,
CGM.getSizeAlign(), "shmem_size");
Address Stream = CGF.CreateTempAlloca(PtrTy, LangAS::Default,
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 40cc275d40273..2468394929360 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -3373,7 +3373,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
// may be aliased, copy it to ensure that the parameter variable is
// mutable and has a unique adress, as C requires.
if (ArgI.getIndirectRealign() || ArgI.isIndirectAliased()) {
- RawAddress AlignedTemp = CreateMemTempWithoutCast(Ty, "coerce");
+ RawAddress AlignedTemp = CreateMemTemp(Ty, "coerce");
// Copy from the incoming argument pointer to the temporary with the
// appropriate alignment.
@@ -3503,8 +3503,8 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
ParameterABI::SwiftErrorResult) {
QualType pointeeTy = Ty->getPointeeType();
assert(pointeeTy->isPointerType());
- RawAddress temp = CreateMemTempWithoutCast(
- pointeeTy, getPointerAlign(), "swifterror.temp");
+ RawAddress temp =
+ CreateMemTemp(pointeeTy, getPointerAlign(), "swifterror.temp");
Address arg = makeNaturalAddressForPointer(
V, pointeeTy, getContext().getTypeAlignInChars(pointeeTy));
llvm::Value *incomingErrorValue = Builder.CreateLoad(arg);
@@ -3556,8 +3556,8 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
llvm::StructType *STy =
dyn_cast<llvm::StructType>(ArgI.getCoerceToType());
- Address Alloca = CreateMemTempWithoutCast(
- Ty, getContext().getDeclAlign(Arg), Arg->getName());
+ Address Alloca =
+ CreateMemTemp(Ty, getContext().getDeclAlign(Arg), Arg->getName());
// Pointer to store into.
Address Ptr = emitAddressAtOffset(*this, Alloca, ArgI);
@@ -3646,8 +3646,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
case ABIArgInfo::CoerceAndExpand: {
// Reconstruct into a temporary.
- Address alloca =
- CreateMemTempWithoutCast(Ty, getContext().getDeclAlign(Arg));
+ Address alloca = CreateMemTemp(Ty, getContext().getDeclAlign(Arg));
ArgVals.push_back(ParamValue::forIndirect(alloca));
auto coercionType = ArgI.getCoerceAndExpandType();
@@ -3688,8 +3687,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
// If this structure was expanded into multiple arguments then
// we need to create a temporary and reconstruct it from the
// arguments.
- Address Alloca =
- CreateMemTempWithoutCast(Ty, getContext().getDeclAlign(Arg));
+ Address Alloca = CreateMemTemp(Ty, getContext().getDeclAlign(Arg));
LValue LV = MakeAddrLValue(Alloca, Ty);
ArgVals.push_back(ParamValue::forIndirect(Alloca));
@@ -3706,8 +3704,8 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
case ABIArgInfo::TargetSpecific: {
auto *AI = Fn->getArg(FirstIRArg);
AI->setName(Arg->getName() + ".target_coerce");
- Address Alloca = CreateMemTempWithoutCast(
- Ty, getContext().getDeclAlign(Arg), Arg->getName());
+ Address Alloca =
+ CreateMemTemp(Ty, getContext().getDeclAlign(Arg), Arg->getName());
Address Ptr = emitAddressAtOffset(*this, Alloca, ArgI);
CGM.getABIInfo().createCoercedStore(AI, Ptr, ArgI, false, *this);
if (CodeGenFunction::hasScalarEvaluationKind(Ty)) {
@@ -3726,8 +3724,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
assert(NumIRArgs == 0);
// Initialize the local variable appropriately.
if (!hasScalarEvaluationKind(Ty)) {
- ArgVals.push_back(
- ParamValue::forIndirect(CreateMemTempWithoutCast(Ty)));
+ ArgVals.push_back(ParamValue::forIndirect(CreateMemTemp(Ty)));
} else {
llvm::Value *U = llvm::UndefValue::get(ConvertType(Arg->getType()));
ArgVals.push_back(ParamValue::forDirect(U));
@@ -5034,7 +5031,7 @@ struct DestroyUnpassedArg final : EHScopeStack::Cleanup {
RValue CallArg::getRValue(CodeGenFunction &CGF) const {
if (!HasLV)
return RV;
- LValue Copy = CGF.MakeAddrLValue(CGF.CreateMemTempWithoutCast(Ty), Ty);
+ LValue Copy = CGF.MakeAddrLValue(CGF.CreateMemTemp(Ty), Ty);
CGF.EmitAggregateCopy(Copy, LV, Ty, AggValueSlot::DoesNotOverlap,
LV.isVolatile());
IsUsed = true;
@@ -5613,8 +5610,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
// For indirect things such as overaligned structs, replace the
// placeholder with a regular aggregate temporary alloca. Store the
// address of this alloca into the struct.
- Addr =
- CreateMemTempWithoutCast(info_it->type, "inalloca.indirect.tmp");
+ Addr = CreateMemTemp(info_it->type, "inalloca.indirect.tmp");
Address ArgSlot = Builder.CreateStructGEP(
ArgMemory, ArgInfo.getInAllocaFieldIndex());
Builder.CreateStore(Addr.getPointer(), ArgSlot);
@@ -5759,8 +5755,8 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
swiftErrorArg = makeNaturalAddressForPointer(
V, pointeeTy, getContext().getTypeAlignInChars(pointeeTy));
- swiftErrorTemp = CreateMemTempWithoutCast(
- pointeeTy, getPointerAlign(), "swifterror.temp");
+ swiftErrorTemp =
+ CreateMemTemp(pointeeTy, getPointerAlign(), "swifterror.temp");
V = swiftErrorTemp.getPointer();
cast<llvm::AllocaInst>(V)->setSwiftError(true);
@@ -5795,7 +5791,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
// FIXME: Avoid the conversion through memory if possible.
Address Src = Address::invalid();
if (!I->isAggregate()) {
- Src = CreateMemTempWithoutCast(I->Ty, "coerce");
+ Src = CreateMemTemp(I->Ty, "coerce");
I->copyInto(*this, Src);
} else {
Src = I->hasLValue() ? I->getKnownLValue().getAddress()
@@ -5952,7 +5948,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
case ABIArgInfo::TargetSpecific: {
Address Src = Address::invalid();
if (!I->isAggregate()) {
- Src = CreateMemTempWithoutCast(I->Ty, "target_coerce");
+ Src = CreateMemTemp(I->Ty, "target_coerce");
I->copyInto(*this, Src);
} else {
Src = I->hasLValue() ? I->getKnownLValue().getAddress()
@@ -6488,7 +6484,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
getContext().getTypeInfoDataSizeInChars(RetTy).Width.getQuantity();
if (!DestPtr.isValid()) {
- DestPtr = CreateMemTempWithoutCast(RetTy, "coerce");
+ DestPtr = CreateMemTemp(RetTy, "coerce");
DestIsVolatile = false;
DestSize = getContext().getTypeSizeInChars(RetTy).getQuantity();
}
@@ -6513,7 +6509,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
Address StorePtr = emitAddressAtOffset(*this, DestPtr, RetAI);
bool DestIsVolatile = ReturnValue.isVolatile();
if (!DestPtr.isValid()) {
- DestPtr = CreateMemTempWithoutCast(RetTy, "target_coerce");
+ DestPtr = CreateMemTemp(RetTy, "target_coerce");
DestIsVolatile = false;
}
CGM.getABIInfo().createCoercedStore(CI, StorePtr, RetAI, DestIsVolatile,
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp
index e52c5f6af2851..de11e8bca43f1 100644
--- a/clang/lib/CodeGen/CGClass.cpp
+++ b/clang/lib/CodeGen/CGClass.cpp
@@ -3190,7 +3190,7 @@ void CodeGenFunction::EmitLambdaStaticInvokeBody(const CXXMethodDecl *MD) {
CanQualType LambdaType = getContext().getCanonicalTagType(Lambda);
CanQualType ThisType = getContext().getPointerType(LambdaType);
- Address ThisPtr = CreateMemTempWithoutCast(LambdaType, "unused.capture");
+ Address ThisPtr = CreateMemTemp(LambdaType, "unused.capture");
CallArgs.add(RValue::get(ThisPtr.emitRawPointer(*this)), ThisType);
EmitLambdaDelegatingInvokeBody(MD, CallArgs);
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 7608f8cb6fc7a..63ad0bc9ec238 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -2724,9 +2724,8 @@ void CodeGenFunction::EmitParmDecl(const VarDecl &D, ParamValue Arg,
UseIndirectDebugAddress = !ArgInfo.getIndirectByVal();
if (UseIndirectDebugAddress) {
auto PtrTy = getContext().getPointerType(Ty);
- AllocaPtr = CreateMemTempWithoutCast(
- PtrTy, getContext().getTypeAlignInChars(PtrTy),
- D.getName() + ".indirect_addr");
+ AllocaPtr = CreateMemTemp(PtrTy, getContext().getTypeAlignInChars(PtrTy),
+ D.getName() + ".indirect_addr");
EmitStoreOfScalar(V, AllocaPtr, /* Volatile */ false, PtrTy);
}
@@ -2763,7 +2762,7 @@ void CodeGenFunction::EmitParmDecl(const VarDecl &D, ParamValue Arg,
DeclPtr = OpenMPLocalAddr;
AllocaPtr = DeclPtr;
} else {
- // Otherwise, create a casted temporary to hold the value.
+ // Otherwise, create a temporary to hold the value.
DeclPtr = CreateMemTemp(Ty, getContext().getDeclAlign(&D),
D.getName() + ".addr", &AllocaPtr);
}
diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp
index 99dfaa80be429..0576582d34543 100644
--- a/clang/lib/CodeGen/CGException.cpp
+++ b/clang/lib/CodeGen/CGException.cpp
@@ -2130,7 +2130,7 @@ void CodeGenFunction::EmitSEHExceptionCodeSave(CodeGenFunction &ParentCGF,
// On Win64, the info is passed as the first parameter to the filter.
SEHInfo = &*CurFn->arg_begin();
SEHCodeSlotStack.push_back(
- CreateMemTempWithoutCast(getContext().IntTy, "__exception_code"));
+ CreateMemTemp(getContext().IntTy, "__exception_code"));
} else {
// On Win32, the EBP on entry to the filter points to the end of an
// exception registration object. It contains 6 32-bit fields, and the info
@@ -2204,7 +2204,7 @@ void CodeGenFunction::EnterSEHTryStmt(const SEHTryStmt &S) {
assert(Except);
EHCatchScope *CatchScope = EHStack.pushCatch(1);
SEHCodeSlotStack.push_back(
- CreateMemTempWithoutCast(getContext().IntTy, "__exception_code"));
+ CreateMemTemp(getContext().IntTy, "__exception_code"));
// If the filter is known to evaluate to 1, then we can use the clause
// "catch i8* null". We can't do this on x86 because the filter has to save
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 77fd47ed42f03..8ca4ee64136c8 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -500,10 +500,7 @@ static RawAddress createReferenceTemporary(CodeGenFunction &CGF,
// FIXME: Should we put the new global into a COMDAT?
return RawAddress(C, GV->getValueType(), alignment);
}
- RawAddress Addr = CGF.CreateMemTempWithoutCast(Ty, "ref.tmp");
- if (Alloca)
- *Alloca = Addr;
- return Addr;
+ return CGF.CreateMemTemp(Ty, "ref.tmp", Alloca);
}
case SD_Thread:
case SD_Static:
@@ -1630,7 +1627,7 @@ RValue CodeGenFunction::GetUndefRValue(QualType Ty) {
// identifiable address. Just because the contents of the value are undefined
// doesn't mean that the address can't be taken and compared.
case TEK_Aggregate: {
- Address DestPtr = CreateMemTempWithoutCast(Ty, "undef.agg.tmp");
+ Address DestPtr = CreateMemTemp(Ty, "undef.agg.tmp");
return RValue::getAggregate(DestPtr);
}
@@ -5970,7 +5967,7 @@ LValue CodeGenFunction::EmitCompoundLiteralLValue(const CompoundLiteralExpr *E){
// make sure to emit the VLA size.
EmitVariablyModifiedType(E->getType());
- Address DeclPtr = CreateMemTempWithoutCast(E->getType(), ".compoundliteral");
+ Address DeclPtr = CreateMemTemp(E->getType(), ".compoundliteral");
const Expr *InitExpr = E->getInitializer();
LValue Result = MakeAddrLValue(DeclPtr, E->getType(), AlignmentSource::Decl);
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index 876d184af1930..00edf3e99a34e 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -2187,7 +2187,7 @@ void CodeGenFunction::EmitAggExpr(const Expr *E, AggValueSlot Slot) {
LValue CodeGenFunction::EmitAggExprToLValue(const Expr *E) {
assert(hasAggregateEvaluationKind(E->getType()) && "Invalid argument!");
- Address Temp = CreateMemTempWithoutCast(E->getType());
+ Address Temp = Cre...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/199685
More information about the cfe-commits
mailing list