[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 26 06:37:35 PST 2025


nikic wrote:

After much suffering, I managed to do a stage2+thinlto build in a Windows VM. I believe this is the root cause:

```llvm
; RUN: opt -S -passes=memcpyopt < %s
declare void @init(ptr)
declare void @update(ptr)

define i32 @test() {
  %a = alloca i32
  %b = alloca i32
  call void @init(ptr captures(none) %a)
  call void @llvm.memcpy(ptr %b, ptr %a, i64 4, i1 false)
  call void @update(ptr captures(ret: address, provenance) %b)
  %v = load i32, ptr %a
  ret i32 %v
}
```

The `%a` and `%b` allocas get combined and memcpy optimized out.

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


More information about the llvm-commits mailing list