mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
2d2b457be4
The `move_value` instruction is only used to specify flags. Remove a `move_value` which either doesn't specify any flags or which flags are not relevant outside the mandatory pipeline, like `[lexical]`.
39 lines
1.1 KiB
Swift
39 lines
1.1 KiB
Swift
//===--- SimplifyMoveValue.swift ------------------------------------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
import SIL
|
|
|
|
/// The `move_value` instruction is only used to specify flags.
|
|
/// Remove a `move_value` which either doesn't specify any flags or which flags are not relevant
|
|
/// outside the mandatory pipeline, like `[lexical]`.
|
|
///
|
|
/// Replaces
|
|
///
|
|
/// ```
|
|
/// %1 = move_value %0
|
|
/// use %1
|
|
/// ```
|
|
/// ->
|
|
/// ```
|
|
/// use %0
|
|
/// ```
|
|
///
|
|
extension MoveValueInst : Simplifiable, SILCombineSimplifiable {
|
|
func simplify(_ context: SimplifyContext) {
|
|
if hasPointerEscape {
|
|
// Keep this flag.
|
|
return
|
|
}
|
|
replace(with: fromValue, context)
|
|
}
|
|
}
|