Skip to content

Conversation

@lanza
Copy link
Member

@lanza lanza commented Nov 27, 2025

Stack from ghstack (oldest at bottom):

This patch implements full support for generating non-virtual thunks in
ClangIR to handle C++ multiple inheritance scenarios where the same virtual
function must be accessible through different base class pointers with
different this-pointer offsets.

[ghstack-poisoned]
lanza added a commit that referenced this pull request Nov 27, 2025
This patch implements full support for generating non-virtual thunks in ClangIR to handle C++ multiple inheritance scenarios where the same virtual function must be accessible through different base class pointers with different this-pointer offsets. ghstack-source-id: 2ff8aae Pull-Request: #2029
}

if (ShouldXRayInstrumentFunction()) {
if (d && ShouldXRayInstrumentFunction()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this matter?

assert(builder.getInsertionBlock() && "Should be valid");

auto fnEndLoc = getLoc(fd->getBody()->getEndLoc());
auto fnEndLoc = (fd && fd->getBody()) ? getLoc(fd->getBody()->getEndLoc())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These several extra changes on locations don't seem necessary (though probably good to have) and are very distracting

func.setGlobalVisibilityAttr(getGlobalVisibilityAttrFromDecl(decl));
getTargetCIRGenInfo().setTargetAttributes(funcDecl, func, *this);

if (const auto *_ = funcDecl->getAttr<CodeSegAttr>())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should both of these NYI assertions be "assert on missing feature" instead? or not handling them cause horrible miscompilations?

assert(!cir::MissingFeatures::ABIArgInfo());
const CIRGenFunctionInfo &callFnInfo = CGM.getTypes().arrangeCXXMethodCall(
callArgs, fpt, RequiredArgs::forPrototypePlus(fpt, 1), prefixArgs);
// assert(callFnInfo.getRegParm() == CurFnInfo->getRegParm() &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the story with these commented pieces?

@@ -0,0 +1,35 @@
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t.cir.ll
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.codegen.ll
// RUN: FileCheck --input-file=%t.cir.ll %s --check-prefix=CIR
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think LLVM vs OCCG here would be more clear. Why there's no proper CIR output here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants