-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[NFC][AMDGPU] Drop recursive types in LowerBufferFatPointers #137735
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Now that IRMover and the rest of LLVM don't allow recursive types, drop support for them from the clone of the IRMover code used when lowering buffer fat pointer operations.
@llvm/pr-subscribers-backend-amdgpu Author: Krzysztof Drewniak (krzysz00) ChangesNow that IRMover and the rest of LLVM don't allow recursive types, drop support for them from the clone of the IRMover code used when lowering buffer fat pointer operations. Full diff: https://github.com/llvm/llvm-project/pull/137735.diff 1 Files Affected:
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp b/llvm/lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp
index 7163ad2aa7dca..284f6ede2b85b 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp
@@ -267,7 +267,7 @@ namespace {
class BufferFatPtrTypeLoweringBase : public ValueMapTypeRemapper {
DenseMap<Type *, Type *> Map;
- Type *remapTypeImpl(Type *Ty, SmallPtrSetImpl<StructType *> &Seen);
+ Type *remapTypeImpl(Type *Ty);
protected:
virtual Type *remapScalar(PointerType *PT) = 0;
@@ -305,8 +305,7 @@ class BufferFatPtrToStructTypeMap : public BufferFatPtrTypeLoweringBase {
} // namespace
// This code is adapted from the type remapper in lib/Linker/IRMover.cpp
-Type *BufferFatPtrTypeLoweringBase::remapTypeImpl(
- Type *Ty, SmallPtrSetImpl<StructType *> &Seen) {
+Type *BufferFatPtrTypeLoweringBase::remapTypeImpl(Type *Ty) {
Type **Entry = &Map[Ty];
if (*Entry)
return *Entry;
@@ -331,18 +330,11 @@ Type *BufferFatPtrTypeLoweringBase::remapTypeImpl(
// require recursion.
if (Ty->getNumContainedTypes() == 0 && IsUniqued)
return *Entry = Ty;
- if (!IsUniqued) {
- // Create a dummy type for recursion purposes.
- if (!Seen.insert(TyAsStruct).second) {
- StructType *Placeholder = StructType::create(Ty->getContext());
- return *Entry = Placeholder;
- }
- }
bool Changed = false;
SmallVector<Type *> ElementTypes(Ty->getNumContainedTypes(), nullptr);
for (unsigned int I = 0, E = Ty->getNumContainedTypes(); I < E; ++I) {
Type *OldElem = Ty->getContainedType(I);
- Type *NewElem = remapTypeImpl(OldElem, Seen);
+ Type *NewElem = remapTypeImpl(OldElem);
ElementTypes[I] = NewElem;
Changed |= (OldElem != NewElem);
}
@@ -366,13 +358,6 @@ Type *BufferFatPtrTypeLoweringBase::remapTypeImpl(
return *Entry = StructType::get(Ty->getContext(), ElementTypes, IsPacked);
SmallString<16> Name(STy->getName());
STy->setName("");
- Type **RecursionEntry = &Map[Ty];
- if (*RecursionEntry) {
- auto *Placeholder = cast<StructType>(*RecursionEntry);
- Placeholder->setBody(ElementTypes, IsPacked);
- Placeholder->setName(Name);
- return *Entry = Placeholder;
- }
return *Entry = StructType::create(Ty->getContext(), ElementTypes, Name,
IsPacked);
}
@@ -380,8 +365,7 @@ Type *BufferFatPtrTypeLoweringBase::remapTypeImpl(
}
Type *BufferFatPtrTypeLoweringBase::remapType(Type *SrcTy) {
- SmallPtrSet<StructType *, 2> Visited;
- return remapTypeImpl(SrcTy, Visited);
+ return remapTypeImpl(SrcTy);
}
Type *BufferFatPtrToStructTypeMap::remapScalar(PointerType *PT) {
|
arsenm
approved these changes
Apr 29, 2025
nikic
approved these changes
Apr 29, 2025
Thanks - nice to see another use of |
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
…7735) Now that IRMover and the rest of LLVM don't allow recursive types, drop support for them from the clone of the IRMover code used when lowering buffer fat pointer operations.
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
…7735) Now that IRMover and the rest of LLVM don't allow recursive types, drop support for them from the clone of the IRMover code used when lowering buffer fat pointer operations.
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
…7735) Now that IRMover and the rest of LLVM don't allow recursive types, drop support for them from the clone of the IRMover code used when lowering buffer fat pointer operations.
GeorgeARM
pushed a commit
to GeorgeARM/llvm-project
that referenced
this pull request
May 7, 2025
…7735) Now that IRMover and the rest of LLVM don't allow recursive types, drop support for them from the clone of the IRMover code used when lowering buffer fat pointer operations.
Ankur-0429
pushed a commit
to Ankur-0429/llvm-project
that referenced
this pull request
May 9, 2025
…7735) Now that IRMover and the rest of LLVM don't allow recursive types, drop support for them from the clone of the IRMover code used when lowering buffer fat pointer operations.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Now that IRMover and the rest of LLVM don't allow recursive types, drop support for them from the clone of the IRMover code used when lowering buffer fat pointer operations.