[llvm] [AArch64] Skip storing of stack arguments when lowering tail calls (PR #126735)

Guy David via llvm-commits llvm-commits at lists.llvm.org
Thu May 29 11:15:56 PDT 2025


guy-david wrote:

@arsenm Any suggestion how to deal with `G_TRUNC`'s in GlobalISel, when lowering an `i1` stack argument?
For
```
declare void @func_i1(..., i1 %j)

define void @wrapper_func_i1(..., i1 %j) {
  tail call void @func_i1(..., i1 %j)
  ret void
}
```
GlobalISel generates:
```
  %13:_(p0) = G_FRAME_INDEX %fixed-stack.1
  %12:_(s32) = G_LOAD %13:_(p0) :: (invariant load (s8) from %fixed-stack.1, align 8)
  %10:_(s8) = G_TRUNC %12:_(s32)
  %14:_(s8) = G_ASSERT_ZEXT %10:_, 1
  %9:_(s1) = G_TRUNC %14:_(s8)
```
These truncations don't appear in SDAG and may not preserve the loaded value so we can't simply skip over them.

https://github.com/llvm/llvm-project/pull/126735


More information about the llvm-commits mailing list