[all-commits] [llvm/llvm-project] 556eb8: [CIR] Function type return type improvements (#128...

David Olsen via All-commits all-commits at lists.llvm.org
Wed Feb 26 20:59:11 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 556eb8244201a81fff7b246561a677a782b69fa0
      https://github.com/llvm/llvm-project/commit/556eb8244201a81fff7b246561a677a782b69fa0
  Author: David Olsen <dolsen at nvidia.com>
  Date:   2025-02-26 (Wed, 26 Feb 2025)

  Changed paths:
    M clang/include/clang/CIR/Dialect/IR/CIROps.td
    M clang/include/clang/CIR/Dialect/IR/CIRTypes.td
    M clang/lib/CIR/CodeGen/CIRGenTypes.cpp
    M clang/lib/CIR/Dialect/IR/CIRDialect.cpp
    M clang/lib/CIR/Dialect/IR/CIRTypes.cpp
    M clang/test/CIR/IR/func.cir
    M clang/test/CIR/IR/global.cir
    M clang/test/CIR/func-simple.cpp
    M clang/test/CIR/global-var-simple.cpp

  Log Message:
  -----------
  [CIR] Function type return type improvements (#128787)

When a C or C++ function has a return type of `void`, the function type
is now represented in MLIR as having no return type rather than having a
return type of `!cir.void`. This avoids breaking MLIR invariants that
require the number of return types and the number of return values to
match.

Change the assembly format for `cir::FuncType` from having a leading
return type to having a trailing return type. In other words, change
```
!cir.func<!returnType (!argTypes)>
```
to
```
!cir.func<(!argTypes) -> !returnType)>
```
Unless the function returns `void`, in which case change
```
!cir.func<!cir.void (!argTypes)>
```
to
```
!cir.func<(!argTypes)>
```



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