Skip to content

Commit ce3d57a

Browse files
committed
Revert "[BPF] Fix a BTF type pruning bug"
This reverts commit 1914953. This fix was accidentally committed.
1 parent 1914953 commit ce3d57a

File tree

2 files changed

+7
-110
lines changed

2 files changed

+7
-110
lines changed

llvm/lib/Target/BPF/BTFDebug.cpp

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -773,31 +773,15 @@ void BTFDebug::visitTypeEntry(const DIType *Ty, uint32_t &TypeId,
773773
// already defined, we should keep moving to eventually
774774
// bring in types for "struct t". Otherwise, the "struct s2"
775775
// definition won't be correct.
776-
//
777-
// In the above, we have following debuginfo:
778-
// {ptr, struct_member} -> typedef -> struct
779-
// and BTF type for 'typedef' is generated while 'struct' may
780-
// be in FixUp. But let us generalize the above to handle
781-
// {different types} -> [various derived types]+ -> another type.
782-
// For example,
783-
// {func_param, struct_member} -> const -> ptr -> volatile -> struct
784-
// We will traverse const/ptr/volatile which already have corresponding
785-
// BTF types and generate type for 'struct' which might be in Fixup
786-
// state.
787776
if (Ty && (!CheckPointer || !SeenPointer)) {
788777
if (const auto *DTy = dyn_cast<DIDerivedType>(Ty)) {
789-
while (DTy) {
790-
const DIType *BaseTy = DTy->getBaseType();
791-
if (!BaseTy)
792-
break;
793-
794-
if (DIToIdMap.find(BaseTy) != DIToIdMap.end()) {
795-
DTy = dyn_cast<DIDerivedType>(BaseTy);
796-
} else {
797-
uint32_t TmpTypeId;
798-
visitTypeEntry(BaseTy, TmpTypeId, CheckPointer, SeenPointer);
799-
break;
800-
}
778+
unsigned Tag = DTy->getTag();
779+
if (Tag == dwarf::DW_TAG_typedef || Tag == dwarf::DW_TAG_const_type ||
780+
Tag == dwarf::DW_TAG_volatile_type ||
781+
Tag == dwarf::DW_TAG_restrict_type) {
782+
uint32_t TmpTypeId;
783+
visitTypeEntry(DTy->getBaseType(), TmpTypeId, CheckPointer,
784+
SeenPointer);
801785
}
802786
}
803787
}

llvm/test/CodeGen/BPF/BTF/pruning-multi-derived-type.ll

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)