[clang] [OpenCL] Put constant initializer globals into constant addrspace (PR #90048)
Changpeng Fang via cfe-commits
cfe-commits at lists.llvm.org
Thu May 16 15:04:55 PDT 2024
================
@@ -535,20 +535,23 @@ void AggExprEmitter::EmitArrayInit(Address DestPtr, llvm::ArrayType *AType,
elementType.isTriviallyCopyableType(CGF.getContext())) {
CodeGen::CodeGenModule &CGM = CGF.CGM;
ConstantEmitter Emitter(CGF);
- LangAS AS = ArrayQTy.getAddressSpace();
+ QualType GVArrayQTy = CGM.getContext().getAddrSpaceQualType(
+ CGM.getContext().removeAddrSpaceQualType(ArrayQTy),
----------------
changpeng wrote:
We saw a regression caused by this PR. It is a soft hang in CGM.getContext().removeAddrSpaceQualType.
Specifically it is in the following while loop:
while (T.hasAddressSpace()) {
TypeNode = Quals.strip(T);
// If the type no longer has an address space after stripping qualifiers,
// jump out.
if (!QualType(TypeNode, 0).hasAddressSpace())
break;
// There might be sugar in the way. Strip it and try again.
T = T.getSingleStepDesugaredType(*this);
}
We found that "T == T.getSingleStepDesugaredType(*this);" and this it could not proceed.
I am not sure whether we should break out this loop when "T == T.getSingleStepDesugaredType(*this)"
or something else is wrong that we should never see such case.
Here is the dump of T:
ConstantArrayType 0x555565b40640 '__private ulong[16]' 16
`-QualType 0x555565b403f8 '__private ulong' __private
`-ElaboratedType 0x555565b3ff40 'ulong' sugar imported
`-TypedefType 0x555565b3fef0 'ulong' sugar imported
|-Typedef 0x555565b3fe80 'ulong'
`-BuiltinType 0x55556583f430 'unsigned long'
https://github.com/llvm/llvm-project/pull/90048
More information about the cfe-commits
mailing list