Skip to content

Conversation

PikachuHyA
Copy link
Collaborator

No description provided.

@PikachuHyA
Copy link
Collaborator Author

Please note that there are differences in the IR generated by ClangIR and OG.

tested with clang/test/CIR/CodeGen/tbaa-vptr.cpp

The LLVM IR produced by OG is as follows:

define dso_local void @_ZN1BD0Ev(ptr noundef nonnull align 8 dereferenceable(9) initializes((0, 8)) %this) unnamed_addr #0 align 2 {
entry:
  store ptr getelementptr inbounds nuw inrange(-16, 16) (i8, ptr @_ZTV1B, i64 16), ptr %this, align 8, !tbaa !5
  %0 = getelementptr inbounds nuw i8, ptr %this, i64 8
  tail call void @_ZN6MemberD1Ev(ptr noundef nonnull align 1 dereferenceable(1) %0) #3
  tail call void @_ZN1AD2Ev(ptr noundef nonnull align 8 dereferenceable(9) %this) #3
  tail call void @_ZdlPvm(ptr noundef %this, i64 noundef 16) #4
  ret void
}

In contrast, the LLVM IR generated by ClangIR is as follows:

define dso_local void @_ZN1BD0Ev(ptr %0) #1 {
  tail call void @_ZN1BD1Ev(ptr %0) #0
  tail call void @_ZdlPvm(ptr %0, i64 16)
  ret void
}

Is there something missing in the ClangIR?

@bcardosolopes
Copy link
Member

Is there something missing in the ClangIR?

Yes, sounds like it's missing one dtor call, let me track this in a separate issues.

@bcardosolopes bcardosolopes merged commit 6b68a48 into llvm:main Mar 13, 2025
7 checks passed
@PikachuHyA PikachuHyA deleted the support_vptr branch March 14, 2025 01:55
terapines-osc-cir pushed a commit to Terapines/clangir that referenced this pull request Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants