[all-commits] [llvm/llvm-project] a9810a: [CIR] Implement devirtualized member function call...

AbdallahRashed via All-commits all-commits at lists.llvm.org
Mon May 4 12:33:38 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a9810adef607381ddf5cafc1fd87ae619b8655d2
      https://github.com/llvm/llvm-project/commit/a9810adef607381ddf5cafc1fd87ae619b8655d2
  Author: AbdallahRashed <63146988+AbdallahRashed at users.noreply.github.com>
  Date:   2026-05-04 (Mon, 04 May 2026)

  Changed paths:
    M clang/include/clang/CIR/MissingFeatures.h
    M clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp
    A clang/test/CIR/CodeGen/devirtualize.cpp
    M clang/test/CIR/CodeGen/vbase.cpp
    M clang/test/CIR/CodeGen/virtual-fn-calls-eh.cpp
    M clang/test/CIR/CodeGen/virtual-function-calls.cpp

  Log Message:
  -----------
  [CIR] Implement devirtualized member function calls (#195106)

Implement the devirtualization logic in
emitCXXMemberOrOperatorMemberCallExpr that was previously guarded by
MissingFeatures::devirtualizeMemberFunction(). This enables the compiler
to emit direct calls instead of virtual dispatch when the dynamic type
can be statically resolved (e.g., final classes, local variables of
known type).

This fixes the 'devirtualized destructor call' errorNYI in
CIRGenExprCXX.cpp, which is point 5 of #192330.

The implementation follows OGCG: use getDevirtualizedMethod() to check
if devirtualization is possible, then getCorrespondingMethodInClass() to
find the target method. For destructors, use getAddrOfFunction() instead
of getAddrOfCXXStructor() since the devirtualized callee may differ from
the original.

Fixes point 5 of #192330.
Supported by : Claude Opus4.6 High



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list