Skip to content

Embedded Swift compiler emits explicit loop instead of memmove() #75729

Open
@michael-jan

Description

@michael-jan

Description

When compiling in Full Swift mode, UnsafeMutablePointer’s update(from:count:) emits a call to memmove(). But in Embedded mode, a less performant explicit loop is emitted.

Reproduction

func f(dst: UnsafeMutablePointer<Int>, src: UnsafePointer<Int>) {
    dst.update(from: src, count: 123)
}

Godbolt: https://godbolt.org/z/s71Mxfoz5

Expected behavior

A call to memmove() is emitted.

Environment

Swift Development Snapshot 2024-08-03

Additional information

No response

Metadata

Metadata

Labels

SILOptimizerArea → compiler: SIL optimization passesbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfembeddedEmbedded Swiftperformanceswift 6.1unexpected behaviorBug: Unexpected behavior or incorrect output

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions