[all-commits] [llvm/llvm-project] b979a1: [CIR] Lower indirect calls in CallConvLowering (#2...
Adam Smith via All-commits
all-commits at lists.llvm.org
Wed Jul 29 10:52:02 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b979a119274a13fdee769478702148006219fc5b
https://github.com/llvm/llvm-project/commit/b979a119274a13fdee769478702148006219fc5b
Author: Adam Smith <adams at nvidia.com>
Date: 2026-07-29 (Wed, 29 Jul 2026)
Changed paths:
M clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp
M clang/lib/CIR/Dialect/Transforms/TargetLowering/CIRABIRewriteContext.cpp
A clang/test/CIR/CodeGen/call-conv-lowering-x86_64-indirect.c
A clang/test/CIR/Transforms/abi-lowering/indirect-call-classification-attr.cir
R clang/test/CIR/Transforms/abi-lowering/indirect-call-nyi.cir
A clang/test/CIR/Transforms/abi-lowering/indirect-call-test-target.cir
A clang/test/CIR/Transforms/abi-lowering/indirect-call.cir
Log Message:
-----------
[CIR] Lower indirect calls in CallConvLowering (#211636)
Indirect calls were unsupported by CallConvLowering. `rewriteCallSite` bailed
with "indirect call not yet implemented", and the pass driver rejected any
module that both needed call-site rewriting and contained an indirect call. A
function pointer whose signature required ABI reshaping (a by-value struct
argument, or an sret return) could not be compiled at all, even though a
direct call to the same signature lowered fine.
The callee is opaque, but its type is a pointer to a `FuncType` that carries the
full signature. Classification is now driven from that pointee signature
through the same LLVM ABI path as the direct case: `classifyX86_64Function` is
split into `classifyX86_64Signature`, taking a return type, an argument
`TypeRange`, and an `emitError` callback. The driver collects indirect calls,
classifies each callee signature (x86_64, or the test target used by the pass
tests), and runs `rewriteCallSite`. `prependIndirectCallee` re-adds the callee
as operand 0, bitcasting the function pointer to the coerced signature when it
differs so the rebuilt call matches its reshaped return.
The `classification-attr` driver mode injects a per-function classification
that cannot describe a callee resolved at run time, so an indirect call is a
diagnosed error there rather than being left silently unrewritten while direct
calls are coerced.
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