Files
carbon-lang/toolchain/lower/testdata/tuple/one_entry.carbon
T
79c0b65288 Separate constant emission from function emission. (#3916)
Make constant emission non-recursive, and stop building a bogus
FunctionContext to emit constants.

To support this, move `InstConstantKind` from the typed instruction
definition into the `.def` file, and add more macros to allow us to
generate case labels based on whether an instruction is a constant.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.com>
2024-04-26 23:27:07 +00:00

30 lines
1.1 KiB
Plaintext

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn Run() -> i32 {
var x: (i32, ) = (1, );
var y: (i32, ) = x;
return 0;
}
// CHECK:STDOUT: ; ModuleID = 'one_entry.carbon'
// CHECK:STDOUT: source_filename = "one_entry.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define i32 @main() {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %x.var = alloca { i32 }, align 8
// CHECK:STDOUT: store { i32 } { i32 1 }, ptr %x.var, align 4
// CHECK:STDOUT: %y.var = alloca { i32 }, align 8
// CHECK:STDOUT: %.loc9_20.1.tuple.elem = getelementptr inbounds { i32 }, ptr %x.var, i32 0, i32 0
// CHECK:STDOUT: %.loc9_20.2 = load i32, ptr %.loc9_20.1.tuple.elem, align 4
// CHECK:STDOUT: %.loc9_20.3.tuple.init = insertvalue { i32 } poison, i32 %.loc9_20.2, 0
// CHECK:STDOUT: store { i32 } %.loc9_20.3.tuple.init, ptr %y.var, align 4
// CHECK:STDOUT: ret i32 0
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; uselistorder directives
// CHECK:STDOUT: uselistorder i32 1, { 0, 2, 1 }