[all-commits] [llvm/llvm-project] f12797: [CIR] Fix namespace, naming, and assert in sret

adams381 via All-commits all-commits at lists.llvm.org
Wed Jun 10 10:27:14 PDT 2026


  Branch: refs/heads/users/adams381/cir-callconv-lowering-indirect-sret
  Home:   https://github.com/llvm/llvm-project
  Commit: f12797b058a96134728b29ad28116a1d867fc48e
      https://github.com/llvm/llvm-project/commit/f12797b058a96134728b29ad28116a1d867fc48e
  Author: Adam Smith <adams at nvidia.com>
  Date:   2026-06-10 (Wed, 10 Jun 2026)

  Changed paths:
    M clang/lib/CIR/Dialect/Transforms/TargetLowering/CIRABIRewriteContext.cpp

  Log Message:
  -----------
  [CIR] Fix namespace, naming, and assert in sret

Remove `using namespace mlir;` from CIRABIRewriteContext.cpp
and qualify all MLIR-namespaced types explicitly with `mlir::`.
Rename `sretOffset` to `hasSRetArg` (bool) -- the name now
reflects that the value is either 0 or 1 and acts as a
presence flag, not an arbitrary offset.  Rename `rewriter` to
`builder` throughout for consistency with the rest of the
calling-convention lowering code.

Assert in `insertSRetStores` that every `cir.return` in an sret
function carries an operand.  CIRGen guarantees the invariant
`cir.return (cir.load %__retval)` for all returns in an
aggregate-returning function; a bare return would indicate the
sret slot was never written, which is a bug.  The previous
`continue` silently ignored that case.

Add an explanatory comment at the `replaceAllUsesWith` call so
it is clear why erasing the alloca immediately after is safe,
and add a comment at the void `ReturnOp::create` call noting
that the operand-free return is intentional -- the sret pointer
now carries the value.



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