diff --git a/toolchain/autoupdate_testdata.py b/toolchain/autoupdate_testdata.py index 338542b9152c0..6f27121ee2c9d 100755 --- a/toolchain/autoupdate_testdata.py +++ b/toolchain/autoupdate_testdata.py @@ -51,10 +51,10 @@ def main() -> None: args = parser.parse_args() if args.non_fatal_checks: - if build_mode == "opt": + if build_mode == "optimize": exit( "`--non-fatal-checks` is incompatible with inferred " - "`-c opt` build mode" + "`-c optimize` build mode" ) configs.append("--config=non-fatal-checks") diff --git a/toolchain/check/testdata/interop/cpp/function/thunk_ast.carbon b/toolchain/check/testdata/interop/cpp/function/thunk_ast.carbon index 4f3b57e444b98..9b5b3511fab89 100644 --- a/toolchain/check/testdata/interop/cpp/function/thunk_ast.carbon +++ b/toolchain/check/testdata/interop/cpp/function/thunk_ast.carbon @@ -64,7 +64,7 @@ auto foo(short a) -> void; // CHECK:STDOUT: | |-ParmVarDecl {{0x[a-f0-9]+}} <> implicit 'std::align_val_t' // CHECK:STDOUT: | `-VisibilityAttr {{0x[a-f0-9]+}} <> Implicit Default // CHECK:STDOUT: |-FunctionDecl {{0x[a-f0-9]+}} <:8:1, line:14:1> line:8:7 operator new 'void *(unsigned long, void *) noexcept' -// CHECK:STDOUT: | |-ParmVarDecl {{0x[a-f0-9]+}} <:173:23, col:37> :8:33 'unsigned long' +// CHECK:STDOUT: | |-ParmVarDecl {{0x[a-f0-9]+}} <:174:23, col:37> :8:33 'unsigned long' // CHECK:STDOUT: | `-ParmVarDecl {{0x[a-f0-9]+}} col:40 'void *' // CHECK:STDOUT: `-FunctionDecl {{0x[a-f0-9]+}} <./thunk_required.h:[[@LINE-51]]:6> col:6 foo__carbon_thunk 'void (short * _Nonnull)' extern // CHECK:STDOUT: |-ParmVarDecl {{0x[a-f0-9]+}} col:6 used a 'short * _Nonnull':'short *' diff --git a/toolchain/codegen/codegen.cpp b/toolchain/codegen/codegen.cpp index 7e9e26b695857..945804bb89418 100644 --- a/toolchain/codegen/codegen.cpp +++ b/toolchain/codegen/codegen.cpp @@ -17,27 +17,6 @@ namespace Carbon { -auto CodeGen::Make(llvm::Module* module, llvm::StringRef target_triple_str, - Diagnostics::Consumer* consumer) -> std::optional { - llvm::Triple target_triple(target_triple_str); - std::string error; - const llvm::Target* target = - llvm::TargetRegistry::lookupTarget(target_triple, error); - CARBON_CHECK(target, "Target should be validated before codegen: {0}", error); - - module->setTargetTriple(target_triple); - - constexpr llvm::StringLiteral CPU = "generic"; - constexpr llvm::StringLiteral Features = ""; - - llvm::TargetOptions target_opts; - CodeGen codegen(module, - consumer ? consumer : &Diagnostics::ConsoleConsumer()); - codegen.target_machine_.reset(target->createTargetMachine( - target_triple, CPU, Features, target_opts, llvm::Reloc::PIC_)); - return codegen; -} - auto CodeGen::EmitAssembly(llvm::raw_pwrite_stream& out) -> bool { return EmitCode(out, llvm::CodeGenFileType::AssemblyFile); } diff --git a/toolchain/codegen/codegen.h b/toolchain/codegen/codegen.h index c67c2b145f519..b145145f500f8 100644 --- a/toolchain/codegen/codegen.h +++ b/toolchain/codegen/codegen.h @@ -14,11 +14,10 @@ namespace Carbon { class CodeGen { public: - // `module` and `errors` must not be null. `consumer` may be null, in which - // case diagnostics go to stderr. - static auto Make(llvm::Module* module, llvm::StringRef target_triple_str, - Diagnostics::Consumer* consumer = nullptr) - -> std::optional; + // `module`, `target_machine`, and `consumer` must not be null. + explicit CodeGen(llvm::Module* module, llvm::TargetMachine* target_machine, + Diagnostics::Consumer* consumer) + : module_(module), target_machine_(target_machine), emitter_(consumer) {} // Generates the object code file. // Returns false in case of failure, and any information about the failure is @@ -35,10 +34,6 @@ class CodeGen { auto EmitAssembly(llvm::raw_pwrite_stream& out) -> bool; private: - // `module` and `consumer` must not be null. - explicit CodeGen(llvm::Module* module, Diagnostics::Consumer* consumer) - : module_(module), emitter_(consumer) {} - // Using the llvm pass emits either assembly or object code to dest. // Returns false in case of failure, and any information about the failure is // printed to the error stream. @@ -47,10 +42,10 @@ class CodeGen { llvm::Module* module_; + llvm::TargetMachine* target_machine_; + // The emitter for diagnostics. Diagnostics::FileEmitter emitter_; - - std::unique_ptr target_machine_; }; } // namespace Carbon diff --git a/toolchain/driver/BUILD b/toolchain/driver/BUILD index 68059db738853..ff22e3c9b0fd5 100644 --- a/toolchain/driver/BUILD +++ b/toolchain/driver/BUILD @@ -155,6 +155,7 @@ cc_library( "//toolchain/language_server", "//toolchain/lex", "//toolchain/lower", + "//toolchain/lower:options", "//toolchain/parse", "//toolchain/parse:tree", "//toolchain/sem_ir:file", @@ -162,6 +163,7 @@ cc_library( "//toolchain/source:source_buffer", "@llvm-project//llvm:Core", "@llvm-project//llvm:MC", + "@llvm-project//llvm:Passes", "@llvm-project//llvm:Support", "@llvm-project//llvm:TargetParser", ], diff --git a/toolchain/driver/compile_subcommand.cpp b/toolchain/driver/compile_subcommand.cpp index 291fdb44cd4b9..95aa8ed040837 100644 --- a/toolchain/driver/compile_subcommand.cpp +++ b/toolchain/driver/compile_subcommand.cpp @@ -16,6 +16,9 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/ScopeExit.h" #include "llvm/MC/TargetRegistry.h" +#include "llvm/Passes/OptimizationLevel.h" +#include "llvm/Passes/PassBuilder.h" +#include "llvm/Passes/StandardInstrumentations.h" #include "toolchain/base/clang_invocation.h" #include "toolchain/base/timings.h" #include "toolchain/check/check.h" @@ -60,6 +63,7 @@ compile to machine code. arg_b.OneOfValue("parse", Phase::Parse), arg_b.OneOfValue("check", Phase::Check), arg_b.OneOfValue("lower", Phase::Lower), + arg_b.OneOfValue("optimize", Phase::Optimize), arg_b.OneOfValue("codegen", Phase::CodeGen).Default(true), }, &phase); @@ -109,6 +113,33 @@ object output can be forced by enabling `--force-obj-output`. }, [&](auto& arg_b) { arg_b.Set(&output_filename); }); + b.AddOneOfOption( + { + .name = "optimize", + .help = R"""( +Selects the amount of optimization to perform. +)""", + }, + [&](auto& arg_b) { + arg_b.SetOneOf( + { + // We intentionally don't expose O2 and Os. The difference + // between these levels tends to reflect what achieves the + // best speed for a specific application, as they all + // largely optimize for speed as the primary factor. + // + // Instead of controlling this with more nuanced flags, we + // plan to support profile and in-source hints to the + // optimizer to adjust its strategy in the specific places + // where the default doesn't have the desired results. + arg_b.OneOfValue("none", Lower::OptimizationLevel::None), + arg_b.OneOfValue("debug", Lower::OptimizationLevel::Debug), + arg_b.OneOfValue("speed", Lower::OptimizationLevel::Speed), + arg_b.OneOfValue("size", Lower::OptimizationLevel::Size), + }, + &opt_level); + }); + // Include the common code generation options at this point to render it // after the more common options above, but before the more unusual options // below. @@ -368,6 +399,8 @@ static auto PhaseToString(CompileOptions::Phase phase) -> std::string { return "check"; case CompileOptions::Phase::Lower: return "lower"; + case CompileOptions::Phase::Optimize: + return "optimize"; case CompileOptions::Phase::CodeGen: return "codegen"; } @@ -408,6 +441,7 @@ auto CompileSubcommand::ValidateOptions( } [[fallthrough]]; case Phase::Lower: + case Phase::Optimize: case Phase::CodeGen: // Everything can be dumped in these phases. break; @@ -422,11 +456,12 @@ class MultiUnitCache; // Ties together information for a file being compiled. class CompilationUnit { public: - // `driver_env`, `options`, and `consumer` must be non-null. + // `driver_env`, `options`, `consumer`, and `target` must be non-null. explicit CompilationUnit(SemIR::CheckIRId check_ir_id, int total_ir_count, DriverEnv* driver_env, const CompileOptions* options, Diagnostics::Consumer* consumer, - llvm::StringRef input_filename); + llvm::StringRef input_filename, + const llvm::Target* target); // Sets the multi-unit cache and initializes dependent member state. auto SetMultiUnitCache(MultiUnitCache* cache) -> void; @@ -446,6 +481,14 @@ class CompilationUnit { // Lower SemIR to LLVM IR. auto RunLower() -> void; + // Runs the optimization pipeline. + auto RunOptimize() -> void; + + // Runs post-lowering-to-LLVM-IR logic. This is always called if we do any + // lowering work, after we've finished building the IR in RunLower() and, + // optionally, RunOptimize(). + auto PostLower() -> void; + auto RunCodeGen() -> void; // Runs post-compile logic. This is always called, and called after all other @@ -484,6 +527,9 @@ class CompilationUnit { // Returns true if the current file should be included in debug dumps. auto IncludeInDumps() -> bool; + // Builds the LLVM target machine. + auto MakeTargetMachine() -> void; + // The index of the unit amongst all units. SemIR::CheckIRId check_ir_id_; // The number of units in total. @@ -491,6 +537,7 @@ class CompilationUnit { DriverEnv* driver_env_; const CompileOptions* options_; + const llvm::Target* target_; SharedValueStores value_stores_; @@ -527,6 +574,7 @@ class CompilationUnit { std::unique_ptr clang_ast_unit_; std::unique_ptr llvm_context_; std::unique_ptr module_; + std::unique_ptr target_machine_; }; // Caches lists that are shared cross-unit. Accessors do lazy caching because @@ -611,11 +659,13 @@ CompilationUnit::CompilationUnit(SemIR::CheckIRId check_ir_id, int total_ir_count, DriverEnv* driver_env, const CompileOptions* options, Diagnostics::Consumer* consumer, - llvm::StringRef input_filename) + llvm::StringRef input_filename, + const llvm::Target* target) : check_ir_id_(check_ir_id), total_ir_count_(total_ir_count), driver_env_(driver_env), options_(options), + target_(target), input_filename_(input_filename), vlog_stream_(driver_env_->vlog_stream) { if (vlog_stream_ != nullptr || options_->stream_errors) { @@ -743,15 +793,149 @@ auto CompilationUnit::RunLower() -> void { options_->run_llvm_verifier ? driver_env_->error_stream : nullptr; options.want_debug_info = options_->include_debug_info; options.vlog_stream = vlog_stream_; - if (options_->dump_llvm_ir && IncludeInDumps()) { - options.dump_stream = driver_env_->output_stream; - } + options.opt_level = options_->opt_level; module_ = Lower::LowerToLLVM(*llvm_context_, driver_env_->fs, cache_->tree_and_subtrees_getters(), *sem_ir_, total_ir_count_, options); }); } +auto CompilationUnit::MakeTargetMachine() -> void { + CARBON_CHECK(module_, "Must call RunLower first"); + CARBON_CHECK(!target_machine_, "Should not call this multiple times"); + + // Set the target on the module. + // TODO: We should do this earlier. Lower should be passed the target triple + // so it can create the module with this already set. + llvm::Triple target_triple(options_->codegen_options.target); + module_->setTargetTriple(target_triple); + + // TODO: Provide flags to control these. + constexpr llvm::StringLiteral CPU = "generic"; + constexpr llvm::StringLiteral Features = ""; + + llvm::TargetOptions target_opts; + target_machine_.reset(target_->createTargetMachine( + target_triple, CPU, Features, target_opts, llvm::Reloc::PIC_)); +} + +// Get the LLVM optimization level corresponding to a Carbon optimization level. +static auto GetLLVMOptimizationLevel(Lower::OptimizationLevel opt_level) + -> llvm::OptimizationLevel { + switch (opt_level) { + case Lower::OptimizationLevel::None: + return llvm::OptimizationLevel::O0; + case Lower::OptimizationLevel::Debug: + return llvm::OptimizationLevel::O1; + case Lower::OptimizationLevel::Size: + return llvm::OptimizationLevel::Oz; + case Lower::OptimizationLevel::Speed: + return llvm::OptimizationLevel::O3; + } +} + +// Get the `-O` flag corresponding to an optimization level. +static auto GetClangOptimizationFlag(Lower::OptimizationLevel opt_level) + -> llvm::StringLiteral { + switch (opt_level) { + case Lower::OptimizationLevel::None: + return "-O0"; + case Lower::OptimizationLevel::Debug: + return "-O1"; + case Lower::OptimizationLevel::Size: + return "-Oz"; + case Lower::OptimizationLevel::Speed: + return "-O3"; + } +} + +auto CompilationUnit::RunOptimize() -> void { + CARBON_CHECK(module_, "Must call RunLower first"); + + // TODO: A lot of the work done here duplicates work done by Clang setting up + // its pass manager. Moreover, we probably want to pick up Clang's + // customizations and make use of its flags for controlling LLVM passes. We + // should consider whether we would be better off running Clang's pass + // pipeline rather than building one of our own, or factoring out enough of + // Clang's pipeline builder that we can reuse and further customize it. + + MakeTargetMachine(); + + // TODO: There's no way to set these automatically from an + // llvm::OptimizationLevel. Add such a mechanism to LLVM and use it from + // here. For now we reconstruct what Clang does by default. + llvm::PipelineTuningOptions pto; + bool opt_for_speed = options_->opt_level == Lower::OptimizationLevel::Speed; + bool opt_for_size_or_speed = + opt_for_speed || options_->opt_level == Lower::OptimizationLevel::Size; + // Loop unrolling is enabled by `--optimize=size` but isn't actually performed + // because we add `optsize` attributes to the function definitions we emit. + pto.LoopUnrolling = opt_for_size_or_speed; + pto.LoopInterleaving = opt_for_size_or_speed; + pto.LoopVectorization = opt_for_speed; + pto.SLPVectorization = opt_for_size_or_speed; + + llvm::LoopAnalysisManager lam; + llvm::FunctionAnalysisManager fam; + llvm::CGSCCAnalysisManager cgam; + llvm::ModuleAnalysisManager mam; + + llvm::PassInstrumentationCallbacks pic; + + // Register standard pass instrumentations. This adds support for things like + // `-print-after-all`. + llvm::StandardInstrumentations si(module_->getContext(), + /*DebugLogging=*/false); + si.registerCallbacks(pic); + + llvm::PassBuilder builder(target_machine_.get(), pto, + /*PGOOpt=*/std::nullopt, &pic); + + // TODO: Add an AssignmentTrackingPass for at least `--optimize=debug`. + + // Set up target library information and add an analysis pass to supply it. + std::unique_ptr tlii(llvm::driver::createTLII( + module_->getTargetTriple(), llvm::driver::VectorLibrary::NoLibrary)); + fam.registerPass([&] { return llvm::TargetLibraryAnalysis(*tlii); }); + + builder.registerModuleAnalyses(mam); + builder.registerCGSCCAnalyses(cgam); + builder.registerFunctionAnalyses(fam); + builder.registerLoopAnalyses(lam); + builder.crossRegisterProxies(lam, fam, cgam, mam); + + llvm::ModulePassManager pass_manager = builder.buildPerModuleDefaultPipeline( + GetLLVMOptimizationLevel(options_->opt_level)); + + if (vlog_stream_) { + CARBON_VLOG("*** Running pass pipeline: "); + pass_manager.printPipeline( + *vlog_stream_, [&pic](llvm::StringRef class_name) { + auto pass_name = pic.getPassNameForClassName(class_name); + return pass_name.empty() ? class_name : pass_name; + }); + CARBON_VLOG(" ***\n"); + } + + LogCall("ModulePassManager::run", "optimize", + [&] { pass_manager.run(*module_, mam); }); + + if (vlog_stream_) { + CARBON_VLOG("*** Optimized llvm::Module ***\n"); + module_->print(*vlog_stream_, /*AAW=*/nullptr, + /*ShouldPreserveUseListOrder=*/false, + /*IsForDebug=*/true); + } +} + +auto CompilationUnit::PostLower() -> void { + CARBON_CHECK(module_, "Must call RunLower first"); + if (options_->dump_llvm_ir && IncludeInDumps()) { + module_->print(*driver_env_->output_stream, /*AAW=*/nullptr, + /*ShouldPreserveUseListOrder=*/true); + } +} + auto CompilationUnit::RunCodeGen() -> void { CARBON_CHECK(module_, "Must call RunLower first"); LogCall("CodeGen", "codegen", [&] { success_ = RunCodeGenHelper(); }); @@ -778,14 +962,13 @@ auto CompilationUnit::PostCompile() -> void { } auto CompilationUnit::RunCodeGenHelper() -> bool { - std::optional codegen = - CodeGen::Make(module_.get(), options_->codegen_options.target, consumer_); - if (!codegen) { - return false; - } + CARBON_CHECK(module_, "Must call RunLower first"); + CARBON_CHECK(target_machine_, "Must call MakeTargetMachine first"); + + CodeGen codegen(module_.get(), target_machine_.get(), consumer_); if (vlog_stream_) { CARBON_VLOG("*** Assembly ***\n"); - codegen->EmitAssembly(*vlog_stream_); + codegen.EmitAssembly(*vlog_stream_); } if (options_->output_filename == "-") { @@ -793,11 +976,11 @@ auto CompilationUnit::RunCodeGenHelper() -> bool { // textual assembly output are all somewhat linked flags. We should add // some validation that they are used correctly. if (options_->force_obj_output) { - if (!codegen->EmitObject(*driver_env_->output_stream)) { + if (!codegen.EmitObject(*driver_env_->output_stream)) { return false; } } else { - if (!codegen->EmitAssembly(*driver_env_->output_stream)) { + if (!codegen.EmitAssembly(*driver_env_->output_stream)) { return false; } } @@ -841,11 +1024,11 @@ auto CompilationUnit::RunCodeGenHelper() -> bool { return false; } if (options_->asm_output) { - if (!codegen->EmitAssembly(output_file)) { + if (!codegen.EmitAssembly(output_file)) { return false; } } else { - if (!codegen->EmitObject(output_file)) { + if (!codegen.EmitObject(output_file)) { return false; } } @@ -910,6 +1093,10 @@ auto CompileSubcommand::Run(DriverEnv& driver_env) -> DriverResult { // defaults to be more stable. // TODO: Decide if we want this. "-fPIE", + // Propagate our optimization level to Clang as a default. This can be + // overridden by Clang arguments, but doing so will only have an effect + // if those arguments affect Clang's IR, not its pass pipeline. + GetClangOptimizationFlag(options_.opt_level).str(), }; if (driver_env.fuzzing && !options_.clang_args.empty()) { // Parsing specific Clang arguments can reach deep into @@ -925,6 +1112,9 @@ auto CompileSubcommand::Run(DriverEnv& driver_env) -> DriverResult { if (!clang_invocation) { return {.success = false}; } + // We will run our own pass pipeline over the IR in the `Optimize` phase, so + // disable Clang's pipeline to avoid optimizing C++ code twice. + clang_invocation->getCodeGenOpts().DisableLLVMPasses = true; } // Find the files comprising the prelude if we are importing it. @@ -952,7 +1142,7 @@ auto CompileSubcommand::Run(DriverEnv& driver_env) -> DriverResult { ++unit_index; return std::make_unique( SemIR::CheckIRId(unit_index), total_unit_count, &driver_env, &options_, - &driver_env.consumer, filename); + &driver_env.consumer, filename, target); }; llvm::append_range(units, llvm::map_range(prelude, unit_builder)); llvm::append_range(units, @@ -1079,11 +1269,18 @@ auto CompileSubcommand::Run(DriverEnv& driver_env) -> DriverResult { return make_result(); } - // Lower. + // Lower and optimize. for (const auto& unit : units) { unit->RunLower(); + + if (options_.phase != CompileOptions::Phase::Lower) { + unit->RunOptimize(); + } + + unit->PostLower(); } - if (options_.phase == CompileOptions::Phase::Lower) { + if (options_.phase == CompileOptions::Phase::Lower || + options_.phase == CompileOptions::Phase::Optimize) { return make_result(); } CARBON_CHECK(options_.phase == CompileOptions::Phase::CodeGen, diff --git a/toolchain/driver/compile_subcommand.h b/toolchain/driver/compile_subcommand.h index a2e459da22594..f467924de1d19 100644 --- a/toolchain/driver/compile_subcommand.h +++ b/toolchain/driver/compile_subcommand.h @@ -14,6 +14,7 @@ #include "toolchain/driver/codegen_options.h" #include "toolchain/driver/driver_env.h" #include "toolchain/driver/driver_subcommand.h" +#include "toolchain/lower/options.h" namespace Carbon { @@ -26,6 +27,7 @@ struct CompileOptions { Parse, Check, Lower, + Optimize, CodeGen, }; @@ -34,6 +36,7 @@ struct CompileOptions { auto Build(CommandLine::CommandBuilder& b) -> void; + Lower::OptimizationLevel opt_level = Lower::OptimizationLevel::Debug; CodegenOptions codegen_options; Phase phase; diff --git a/toolchain/driver/testdata/compile/optimize/clang_no_optimize_twice.carbon b/toolchain/driver/testdata/compile/optimize/clang_no_optimize_twice.carbon new file mode 100644 index 0000000000000..eb72f695f4363 --- /dev/null +++ b/toolchain/driver/testdata/compile/optimize/clang_no_optimize_twice.carbon @@ -0,0 +1,74 @@ +// 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 +// +// ARGS: compile --optimize=none foo.carbon --target=x86_64-unknown-linux-gnu --phase=optimize --dump-llvm-ir --exclude-dump-file-prefix=%{core} --clang-arg=-O3 +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/optimize/clang_no_optimize_twice.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/optimize/clang_no_optimize_twice.carbon + +// --- foo.carbon + +import Cpp inline '''c++ +// This should not be `optnone`, because Clang had `-O3`. +inline int f() { return 42; } + +// The call to `f()` should not be inlined because Carbon had `--optimize=none`, +// so we don't run the inliner. +int g() { return f(); } +'''; + +// This should be emitted `optnone`. +fn Call() -> i32 { + return Cpp.g(); +} + +// CHECK:STDOUT: ; ModuleID = 'foo.carbon' +// CHECK:STDOUT: source_filename = "foo.carbon" +// CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" +// CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" +// CHECK:STDOUT: +// CHECK:STDOUT: $_Z1fv = comdat any +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: noinline nounwind optnone +// CHECK:STDOUT: define i32 @_CCall.Main() #0 !dbg !7 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %g.call = call i32 @_Z1gv(), !dbg !10 +// CHECK:STDOUT: ret i32 %g.call, !dbg !11 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: mustprogress noinline optnone +// CHECK:STDOUT: define dso_local i32 @_Z1gv() #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %call = call i32 @_Z1fv() +// CHECK:STDOUT: ret i32 %call +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: mustprogress noinline nounwind optnone +// CHECK:STDOUT: define linkonce_odr dso_local i32 @_Z1fv() #2 comdat { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: ret i32 42 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { noinline nounwind optnone } +// CHECK:STDOUT: attributes #1 = { mustprogress noinline optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: +// CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} +// CHECK:STDOUT: !llvm.dbg.cu = !{!5} +// CHECK:STDOUT: +// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5} +// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3} +// CHECK:STDOUT: !2 = !{i32 1, !"wchar_size", i32 4} +// CHECK:STDOUT: !3 = !{i32 8, !"PIC Level", i32 0} +// CHECK:STDOUT: !4 = !{i32 7, !"PIE Level", i32 2} +// CHECK:STDOUT: !5 = distinct !DICompileUnit(language: DW_LANG_C, file: !6, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +// CHECK:STDOUT: !6 = !DIFile(filename: "foo.carbon", directory: "") +// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "Call", linkageName: "_CCall.Main", scope: null, file: !6, line: 12, type: !8, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !8 = !DISubroutineType(types: !9) +// CHECK:STDOUT: !9 = !{} +// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 10, scope: !7) +// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 3, scope: !7) diff --git a/toolchain/driver/testdata/compile/optimize/fail_clang_forward_optimize_size.carbon b/toolchain/driver/testdata/compile/optimize/fail_clang_forward_optimize_size.carbon new file mode 100644 index 0000000000000..ba4c10f656895 --- /dev/null +++ b/toolchain/driver/testdata/compile/optimize/fail_clang_forward_optimize_size.carbon @@ -0,0 +1,16 @@ +// 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 +// +// ARGS: compile --optimize=size %s -- -### +// +// SET-CAPTURE-CONSOLE-OUTPUT +// SET-CHECK-SUBSET +// NOAUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/optimize/fail_clang_forward_optimize_size.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/optimize/fail_clang_forward_optimize_size.carbon +// CHECK:STDERR: "{{.*}}/toolchain/install/prefix_root/lib/carbon/../../lib/carbon/llvm/bin/clang" "-cc1" {{.*}} "-Oz" {{.*}} + +// --- fail_foo.carbon diff --git a/toolchain/driver/testdata/compile/optimize/fail_clang_forward_optimize_speed.carbon b/toolchain/driver/testdata/compile/optimize/fail_clang_forward_optimize_speed.carbon new file mode 100644 index 0000000000000..b3c926a335541 --- /dev/null +++ b/toolchain/driver/testdata/compile/optimize/fail_clang_forward_optimize_speed.carbon @@ -0,0 +1,16 @@ +// 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 +// +// ARGS: compile --optimize=speed %s -- -### +// +// SET-CAPTURE-CONSOLE-OUTPUT +// SET-CHECK-SUBSET +// NOAUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/optimize/fail_clang_forward_optimize_speed.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/optimize/fail_clang_forward_optimize_speed.carbon +// CHECK:STDERR: "{{.*}}/toolchain/install/prefix_root/lib/carbon/../../lib/carbon/llvm/bin/clang" "-cc1" {{.*}} "-O3" {{.*}} + +// --- fail_foo.carbon diff --git a/toolchain/driver/testdata/compile/optimize/fail_clang_no_optimize_arg.carbon b/toolchain/driver/testdata/compile/optimize/fail_clang_no_optimize_arg.carbon new file mode 100644 index 0000000000000..45ea76b6cc2de --- /dev/null +++ b/toolchain/driver/testdata/compile/optimize/fail_clang_no_optimize_arg.carbon @@ -0,0 +1,16 @@ +// 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 +// +// ARGS: compile %s -- -### +// +// SET-CAPTURE-CONSOLE-OUTPUT +// SET-CHECK-SUBSET +// NOAUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/optimize/fail_clang_no_optimize_arg.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/optimize/fail_clang_no_optimize_arg.carbon +// CHECK:STDERR: "{{.*}}/toolchain/install/prefix_root/lib/carbon/../../lib/carbon/llvm/bin/clang" "-cc1" {{.*}} "-O1" {{.*}} + +// --- fail_foo.carbon diff --git a/toolchain/driver/testdata/compile/optimize/fail_clang_override_optimize_arg.carbon b/toolchain/driver/testdata/compile/optimize/fail_clang_override_optimize_arg.carbon new file mode 100644 index 0000000000000..e7d937b7909c6 --- /dev/null +++ b/toolchain/driver/testdata/compile/optimize/fail_clang_override_optimize_arg.carbon @@ -0,0 +1,16 @@ +// 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 +// +// ARGS: compile --optimize=speed --clang-arg=-O1 %s -- -### +// +// SET-CAPTURE-CONSOLE-OUTPUT +// SET-CHECK-SUBSET +// NOAUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/optimize/fail_clang_override_optimize_arg.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/optimize/fail_clang_override_optimize_arg.carbon +// CHECK:STDERR: "{{.*}}/toolchain/install/prefix_root/lib/carbon/../../lib/carbon/llvm/bin/clang" "-cc1" {{.*}} "-O1" {{.*}} + +// --- fail_foo.carbon diff --git a/toolchain/driver/testdata/compile/optimize/optimize_debug.carbon b/toolchain/driver/testdata/compile/optimize/optimize_debug.carbon new file mode 100644 index 0000000000000..18b33add38d14 --- /dev/null +++ b/toolchain/driver/testdata/compile/optimize/optimize_debug.carbon @@ -0,0 +1,117 @@ +// 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 +// +// ARGS: compile --optimize=debug foo.carbon --target=x86_64-unknown-linux-gnu --phase=optimize --dump-llvm-ir --exclude-dump-file-prefix=%{core} +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/optimize/optimize_debug.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/optimize/optimize_debug.carbon + +// --- foo.carbon + +import Core library "range"; + +fn Rand() -> i32; + +fn NoInlineWithOz() -> i32 { + return Rand() + Rand(); +} + +fn CallNoInlineWithOptSize() -> i32 { + // Should not be inlined with --optimize=size, because the body is larger than the call. + return NoInlineWithOz(); +} + +fn VectorizedWithOptSpeed(a: array(i32, 65536)*) { + // Should be vectorized with --optimize=speed, but not in other modes. + var n: i32 = 0; + while (n < 65536) { + (*a)[n] *= 2; + ++n; + } +} + +// CHECK:STDOUT: ; ModuleID = 'foo.carbon' +// CHECK:STDOUT: source_filename = "foo.carbon" +// CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" +// CHECK:STDOUT: +// CHECK:STDOUT: declare i32 @_CRand.Main() local_unnamed_addr +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CNoInlineWithOz.Main() local_unnamed_addr #0 !dbg !4 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %Rand.call.loc7_15 = tail call i32 @_CRand.Main() #0, !dbg !7 +// CHECK:STDOUT: %Rand.call.loc7_24 = tail call i32 @_CRand.Main() #0, !dbg !8 +// CHECK:STDOUT: %Int.as.AddWith.impl.Op.call = add i32 %Rand.call.loc7_24, %Rand.call.loc7_15, !dbg !7 +// CHECK:STDOUT: ret i32 %Int.as.AddWith.impl.Op.call, !dbg !9 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CCallNoInlineWithOptSize.Main() local_unnamed_addr #0 !dbg !10 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %Rand.call.loc7_15.i = tail call i32 @_CRand.Main() #0, !dbg !11 +// CHECK:STDOUT: %Rand.call.loc7_24.i = tail call i32 @_CRand.Main() #0, !dbg !13 +// CHECK:STDOUT: %Int.as.AddWith.impl.Op.call.i = add i32 %Rand.call.loc7_24.i, %Rand.call.loc7_15.i, !dbg !11 +// CHECK:STDOUT: ret i32 %Int.as.AddWith.impl.Op.call.i, !dbg !14 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) +// CHECK:STDOUT: define void @_CVectorizedWithOptSpeed.Main(ptr captures(none) %a) local_unnamed_addr #1 !dbg !15 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: br label %while.body, !dbg !16 +// CHECK:STDOUT: +// CHECK:STDOUT: while.body: ; preds = %entry, %while.body +// CHECK:STDOUT: %n.var.03 = phi i32 [ 0, %entry ], [ %1, %while.body ] +// CHECK:STDOUT: %0 = zext nneg i32 %n.var.03 to i64, !dbg !17 +// CHECK:STDOUT: %.loc19_11.array.index = getelementptr inbounds nuw i32, ptr %a, i64 %0, !dbg !17 +// CHECK:STDOUT: %Int.as.MulAssignWith.impl.Op.call = load i32, ptr %.loc19_11.array.index, align 4, !dbg !17 +// CHECK:STDOUT: %Int.as.MulAssignWith.impl.Op.call1 = shl i32 %Int.as.MulAssignWith.impl.Op.call, 1, !dbg !17 +// CHECK:STDOUT: store i32 %Int.as.MulAssignWith.impl.Op.call1, ptr %.loc19_11.array.index, align 4, !dbg !17 +// CHECK:STDOUT: %1 = add nuw nsw i32 %n.var.03, 1, !dbg !18 +// CHECK:STDOUT: %Int.as.OrderedWith.impl.Less.call = icmp samesign ult i32 %n.var.03, 65535, !dbg !24 +// CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Less.call, label %while.body, label %while.done, !dbg !16 +// CHECK:STDOUT: +// CHECK:STDOUT: while.done: ; preds = %while.body +// CHECK:STDOUT: ret void, !dbg !25 +// CHECK:STDOUT: +// CHECK:STDOUT: ; uselistorder directives +// CHECK:STDOUT: uselistorder label %while.body, { 1, 0 } +// CHECK:STDOUT: uselistorder i32 %n.var.03, { 0, 2, 1 } +// CHECK:STDOUT: uselistorder ptr %.loc19_11.array.index, { 1, 0 } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nofree norecurse nosync nounwind memory(argmem: readwrite) } +// CHECK:STDOUT: +// CHECK:STDOUT: !llvm.module.flags = !{!0, !1} +// CHECK:STDOUT: !llvm.dbg.cu = !{!2} +// CHECK:STDOUT: +// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5} +// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3} +// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +// CHECK:STDOUT: !3 = !DIFile(filename: "foo.carbon", directory: "") +// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "NoInlineWithOz", linkageName: "_CNoInlineWithOz.Main", scope: null, file: !3, line: 6, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !5 = !DISubroutineType(types: !6) +// CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 7, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 7, column: 19, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 7, column: 3, scope: !4) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "CallNoInlineWithOptSize", linkageName: "_CCallNoInlineWithOptSize.Main", scope: null, file: !3, line: 10, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 7, column: 10, scope: !4, inlinedAt: !12) +// CHECK:STDOUT: !12 = distinct !DILocation(line: 12, column: 10, scope: !10) +// CHECK:STDOUT: !13 = !DILocation(line: 7, column: 19, scope: !4, inlinedAt: !12) +// CHECK:STDOUT: !14 = !DILocation(line: 12, column: 3, scope: !10) +// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "VectorizedWithOptSpeed", linkageName: "_CVectorizedWithOptSpeed.Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !16 = !DILocation(line: 18, column: 9, scope: !15) +// CHECK:STDOUT: !17 = !DILocation(line: 19, column: 5, scope: !15) +// CHECK:STDOUT: !18 = !DILocation(line: 275, column: 3, scope: !19, inlinedAt: !21) +// CHECK:STDOUT: !19 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e", scope: null, file: !20, line: 275, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !20 = !DIFile(filename: "{{.*}}/prelude/types/int.carbon", directory: "") +// CHECK:STDOUT: !21 = distinct !DILocation(line: 341, column: 5, scope: !22, inlinedAt: !23) +// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "Op", linkageName: "_COp.Int.Core:Inc.Core.be1e879c1ad406d8", scope: null, file: !20, line: 339, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !23 = distinct !DILocation(line: 20, column: 5, scope: !15) +// CHECK:STDOUT: !24 = !DILocation(line: 18, column: 10, scope: !15) +// CHECK:STDOUT: !25 = !DILocation(line: 15, column: 1, scope: !15) diff --git a/toolchain/driver/testdata/compile/optimize/optimize_default.carbon b/toolchain/driver/testdata/compile/optimize/optimize_default.carbon new file mode 100644 index 0000000000000..0a83a456adea4 --- /dev/null +++ b/toolchain/driver/testdata/compile/optimize/optimize_default.carbon @@ -0,0 +1,117 @@ +// 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 +// +// ARGS: compile foo.carbon --target=x86_64-unknown-linux-gnu --phase=optimize --dump-llvm-ir --exclude-dump-file-prefix=%{core} +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/optimize/optimize_default.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/optimize/optimize_default.carbon + +// --- foo.carbon + +import Core library "range"; + +fn Rand() -> i32; + +fn NoInlineWithOz() -> i32 { + return Rand() + Rand(); +} + +fn CallNoInlineWithOptSize() -> i32 { + // Should not be inlined with --optimize=size, because the body is larger than the call. + return NoInlineWithOz(); +} + +fn VectorizedWithOptSpeed(a: array(i32, 65536)*) { + // Should be vectorized with --optimize=speed, but not in other modes. + var n: i32 = 0; + while (n < 65536) { + (*a)[n] *= 2; + ++n; + } +} + +// CHECK:STDOUT: ; ModuleID = 'foo.carbon' +// CHECK:STDOUT: source_filename = "foo.carbon" +// CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" +// CHECK:STDOUT: +// CHECK:STDOUT: declare i32 @_CRand.Main() local_unnamed_addr +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CNoInlineWithOz.Main() local_unnamed_addr #0 !dbg !4 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %Rand.call.loc7_15 = tail call i32 @_CRand.Main() #0, !dbg !7 +// CHECK:STDOUT: %Rand.call.loc7_24 = tail call i32 @_CRand.Main() #0, !dbg !8 +// CHECK:STDOUT: %Int.as.AddWith.impl.Op.call = add i32 %Rand.call.loc7_24, %Rand.call.loc7_15, !dbg !7 +// CHECK:STDOUT: ret i32 %Int.as.AddWith.impl.Op.call, !dbg !9 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CCallNoInlineWithOptSize.Main() local_unnamed_addr #0 !dbg !10 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %Rand.call.loc7_15.i = tail call i32 @_CRand.Main() #0, !dbg !11 +// CHECK:STDOUT: %Rand.call.loc7_24.i = tail call i32 @_CRand.Main() #0, !dbg !13 +// CHECK:STDOUT: %Int.as.AddWith.impl.Op.call.i = add i32 %Rand.call.loc7_24.i, %Rand.call.loc7_15.i, !dbg !11 +// CHECK:STDOUT: ret i32 %Int.as.AddWith.impl.Op.call.i, !dbg !14 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) +// CHECK:STDOUT: define void @_CVectorizedWithOptSpeed.Main(ptr captures(none) %a) local_unnamed_addr #1 !dbg !15 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: br label %while.body, !dbg !16 +// CHECK:STDOUT: +// CHECK:STDOUT: while.body: ; preds = %entry, %while.body +// CHECK:STDOUT: %n.var.03 = phi i32 [ 0, %entry ], [ %1, %while.body ] +// CHECK:STDOUT: %0 = zext nneg i32 %n.var.03 to i64, !dbg !17 +// CHECK:STDOUT: %.loc19_11.array.index = getelementptr inbounds nuw i32, ptr %a, i64 %0, !dbg !17 +// CHECK:STDOUT: %Int.as.MulAssignWith.impl.Op.call = load i32, ptr %.loc19_11.array.index, align 4, !dbg !17 +// CHECK:STDOUT: %Int.as.MulAssignWith.impl.Op.call1 = shl i32 %Int.as.MulAssignWith.impl.Op.call, 1, !dbg !17 +// CHECK:STDOUT: store i32 %Int.as.MulAssignWith.impl.Op.call1, ptr %.loc19_11.array.index, align 4, !dbg !17 +// CHECK:STDOUT: %1 = add nuw nsw i32 %n.var.03, 1, !dbg !18 +// CHECK:STDOUT: %Int.as.OrderedWith.impl.Less.call = icmp samesign ult i32 %n.var.03, 65535, !dbg !24 +// CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Less.call, label %while.body, label %while.done, !dbg !16 +// CHECK:STDOUT: +// CHECK:STDOUT: while.done: ; preds = %while.body +// CHECK:STDOUT: ret void, !dbg !25 +// CHECK:STDOUT: +// CHECK:STDOUT: ; uselistorder directives +// CHECK:STDOUT: uselistorder label %while.body, { 1, 0 } +// CHECK:STDOUT: uselistorder i32 %n.var.03, { 0, 2, 1 } +// CHECK:STDOUT: uselistorder ptr %.loc19_11.array.index, { 1, 0 } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nofree norecurse nosync nounwind memory(argmem: readwrite) } +// CHECK:STDOUT: +// CHECK:STDOUT: !llvm.module.flags = !{!0, !1} +// CHECK:STDOUT: !llvm.dbg.cu = !{!2} +// CHECK:STDOUT: +// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5} +// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3} +// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +// CHECK:STDOUT: !3 = !DIFile(filename: "foo.carbon", directory: "") +// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "NoInlineWithOz", linkageName: "_CNoInlineWithOz.Main", scope: null, file: !3, line: 6, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !5 = !DISubroutineType(types: !6) +// CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 7, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 7, column: 19, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 7, column: 3, scope: !4) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "CallNoInlineWithOptSize", linkageName: "_CCallNoInlineWithOptSize.Main", scope: null, file: !3, line: 10, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 7, column: 10, scope: !4, inlinedAt: !12) +// CHECK:STDOUT: !12 = distinct !DILocation(line: 12, column: 10, scope: !10) +// CHECK:STDOUT: !13 = !DILocation(line: 7, column: 19, scope: !4, inlinedAt: !12) +// CHECK:STDOUT: !14 = !DILocation(line: 12, column: 3, scope: !10) +// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "VectorizedWithOptSpeed", linkageName: "_CVectorizedWithOptSpeed.Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !16 = !DILocation(line: 18, column: 9, scope: !15) +// CHECK:STDOUT: !17 = !DILocation(line: 19, column: 5, scope: !15) +// CHECK:STDOUT: !18 = !DILocation(line: 275, column: 3, scope: !19, inlinedAt: !21) +// CHECK:STDOUT: !19 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e", scope: null, file: !20, line: 275, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !20 = !DIFile(filename: "{{.*}}/prelude/types/int.carbon", directory: "") +// CHECK:STDOUT: !21 = distinct !DILocation(line: 341, column: 5, scope: !22, inlinedAt: !23) +// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "Op", linkageName: "_COp.Int.Core:Inc.Core.be1e879c1ad406d8", scope: null, file: !20, line: 339, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !23 = distinct !DILocation(line: 20, column: 5, scope: !15) +// CHECK:STDOUT: !24 = !DILocation(line: 18, column: 10, scope: !15) +// CHECK:STDOUT: !25 = !DILocation(line: 15, column: 1, scope: !15) diff --git a/toolchain/driver/testdata/compile/optimize/optimize_none.carbon b/toolchain/driver/testdata/compile/optimize/optimize_none.carbon new file mode 100644 index 0000000000000..fbe8df7247968 --- /dev/null +++ b/toolchain/driver/testdata/compile/optimize/optimize_none.carbon @@ -0,0 +1,145 @@ +// 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 +// +// ARGS: compile --optimize=none foo.carbon --target=x86_64-unknown-linux-gnu --phase=optimize --dump-llvm-ir --exclude-dump-file-prefix=%{core} +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/optimize/optimize_none.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/optimize/optimize_none.carbon + +// --- foo.carbon + +import Core library "range"; + +fn Rand() -> i32; + +fn NoInlineWithOz() -> i32 { + return Rand() + Rand(); +} + +fn CallNoInlineWithOptSize() -> i32 { + // Should not be inlined with --optimize=size, because the body is larger than the call. + return NoInlineWithOz(); +} + +fn VectorizedWithOptSpeed(a: array(i32, 65536)*) { + // Should be vectorized with --optimize=speed, but not in other modes. + var n: i32 = 0; + while (n < 65536) { + (*a)[n] *= 2; + ++n; + } +} + +// CHECK:STDOUT: ; ModuleID = 'foo.carbon' +// CHECK:STDOUT: source_filename = "foo.carbon" +// CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" +// CHECK:STDOUT: +// CHECK:STDOUT: declare i32 @_CRand.Main() +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: noinline nounwind optnone +// CHECK:STDOUT: define i32 @_CNoInlineWithOz.Main() #0 !dbg !4 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %Rand.call.loc7_15 = call i32 @_CRand.Main(), !dbg !7 +// CHECK:STDOUT: %Rand.call.loc7_24 = call i32 @_CRand.Main(), !dbg !8 +// CHECK:STDOUT: %Int.as.AddWith.impl.Op.call = add i32 %Rand.call.loc7_15, %Rand.call.loc7_24, !dbg !7 +// CHECK:STDOUT: ret i32 %Int.as.AddWith.impl.Op.call, !dbg !9 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: noinline nounwind optnone +// CHECK:STDOUT: define i32 @_CCallNoInlineWithOptSize.Main() #0 !dbg !10 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %NoInlineWithOz.call = call i32 @_CNoInlineWithOz.Main(), !dbg !11 +// CHECK:STDOUT: ret i32 %NoInlineWithOz.call, !dbg !12 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: noinline nounwind optnone +// CHECK:STDOUT: define void @_CVectorizedWithOptSpeed.Main(ptr %a) #0 !dbg !13 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !14 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %n.var), !dbg !14 +// CHECK:STDOUT: store i32 0, ptr %n.var, align 4, !dbg !14 +// CHECK:STDOUT: br label %while.cond, !dbg !15 +// CHECK:STDOUT: +// CHECK:STDOUT: while.cond: ; preds = %while.body, %entry +// CHECK:STDOUT: %.loc18_10 = load i32, ptr %n.var, align 4, !dbg !16 +// CHECK:STDOUT: %Int.as.OrderedWith.impl.Less.call = icmp slt i32 %.loc18_10, 65536, !dbg !16 +// CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Less.call, label %while.body, label %while.done, !dbg !15 +// CHECK:STDOUT: +// CHECK:STDOUT: while.body: ; preds = %while.cond +// CHECK:STDOUT: %.loc19_10 = load i32, ptr %n.var, align 4, !dbg !17 +// CHECK:STDOUT: %.loc19_11.array.index = getelementptr inbounds [65536 x i32], ptr %a, i32 0, i32 %.loc19_10, !dbg !18 +// CHECK:STDOUT: %Int.as.MulAssignWith.impl.Op.call = load i32, ptr %.loc19_11.array.index, align 4, !dbg !18 +// CHECK:STDOUT: %Int.as.MulAssignWith.impl.Op.call1 = mul i32 %Int.as.MulAssignWith.impl.Op.call, 2, !dbg !18 +// CHECK:STDOUT: store i32 %Int.as.MulAssignWith.impl.Op.call1, ptr %.loc19_11.array.index, align 4, !dbg !18 +// CHECK:STDOUT: call void @"_COp.Int.Core:Inc.Core.be1e879c1ad406d8"(ptr %n.var), !dbg !19 +// CHECK:STDOUT: br label %while.cond, !dbg !20 +// CHECK:STDOUT: +// CHECK:STDOUT: while.done: ; preds = %while.cond +// CHECK:STDOUT: ret void, !dbg !21 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: noinline nounwind optnone +// CHECK:STDOUT: define linkonce_odr void @"_COp.Int.Core:Inc.Core.be1e879c1ad406d8"(ptr %self) #0 !dbg !22 { +// CHECK:STDOUT: call void @"_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e"(ptr %self, i32 1), !dbg !24 +// CHECK:STDOUT: ret void, !dbg !25 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: noinline nounwind optnone +// CHECK:STDOUT: define linkonce_odr void @"_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e"(ptr %self, i32 %other) #0 !dbg !26 { +// CHECK:STDOUT: %1 = call i32 @"_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899"(i32 %other), !dbg !27 +// CHECK:STDOUT: %2 = load i32, ptr %self, align 4, !dbg !28 +// CHECK:STDOUT: %3 = add i32 %2, %1, !dbg !28 +// CHECK:STDOUT: store i32 %3, ptr %self, align 4, !dbg !28 +// CHECK:STDOUT: ret void, !dbg !28 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: noinline nounwind optnone +// CHECK:STDOUT: define linkonce_odr i32 @"_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899"(i32 %self) #0 !dbg !29 { +// CHECK:STDOUT: ret i32 %self, !dbg !31 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { noinline nounwind optnone } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: +// CHECK:STDOUT: !llvm.module.flags = !{!0, !1} +// CHECK:STDOUT: !llvm.dbg.cu = !{!2} +// CHECK:STDOUT: +// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5} +// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3} +// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +// CHECK:STDOUT: !3 = !DIFile(filename: "foo.carbon", directory: "") +// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "NoInlineWithOz", linkageName: "_CNoInlineWithOz.Main", scope: null, file: !3, line: 6, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !5 = !DISubroutineType(types: !6) +// CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 7, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 7, column: 19, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 7, column: 3, scope: !4) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "CallNoInlineWithOptSize", linkageName: "_CCallNoInlineWithOptSize.Main", scope: null, file: !3, line: 10, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 12, column: 10, scope: !10) +// CHECK:STDOUT: !12 = !DILocation(line: 12, column: 3, scope: !10) +// CHECK:STDOUT: !13 = distinct !DISubprogram(name: "VectorizedWithOptSpeed", linkageName: "_CVectorizedWithOptSpeed.Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !14 = !DILocation(line: 17, column: 3, scope: !13) +// CHECK:STDOUT: !15 = !DILocation(line: 18, column: 9, scope: !13) +// CHECK:STDOUT: !16 = !DILocation(line: 18, column: 10, scope: !13) +// CHECK:STDOUT: !17 = !DILocation(line: 19, column: 10, scope: !13) +// CHECK:STDOUT: !18 = !DILocation(line: 19, column: 5, scope: !13) +// CHECK:STDOUT: !19 = !DILocation(line: 20, column: 5, scope: !13) +// CHECK:STDOUT: !20 = !DILocation(line: 18, column: 3, scope: !13) +// CHECK:STDOUT: !21 = !DILocation(line: 15, column: 1, scope: !13) +// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "Op", linkageName: "_COp.Int.Core:Inc.Core.be1e879c1ad406d8", scope: null, file: !23, line: 339, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !23 = !DIFile(filename: "{{.*}}/prelude/types/int.carbon", directory: "") +// CHECK:STDOUT: !24 = !DILocation(line: 341, column: 5, scope: !22) +// CHECK:STDOUT: !25 = !DILocation(line: 339, column: 3, scope: !22) +// CHECK:STDOUT: !26 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e", scope: null, file: !23, line: 275, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !27 = !DILocation(line: 4294967295, scope: !26) +// CHECK:STDOUT: !28 = !DILocation(line: 275, column: 3, scope: !26) +// CHECK:STDOUT: !29 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899", scope: null, file: !30, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !30 = !DIFile(filename: "{{.*}}/prelude/operators/as.carbon", directory: "") +// CHECK:STDOUT: !31 = !DILocation(line: 24, column: 38, scope: !29) diff --git a/toolchain/driver/testdata/compile/optimize/optimize_size.carbon b/toolchain/driver/testdata/compile/optimize/optimize_size.carbon new file mode 100644 index 0000000000000..222c05f60811f --- /dev/null +++ b/toolchain/driver/testdata/compile/optimize/optimize_size.carbon @@ -0,0 +1,145 @@ +// 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 +// +// ARGS: compile --optimize=size foo.carbon --target=x86_64-unknown-linux-gnu --phase=lower --dump-llvm-ir --exclude-dump-file-prefix=%{core} +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/optimize/optimize_size.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/optimize/optimize_size.carbon + +// --- foo.carbon + +import Core library "range"; + +fn Rand() -> i32; + +fn NoInlineWithOz() -> i32 { + return Rand() + Rand(); +} + +fn CallNoInlineWithOptSize() -> i32 { + // Should not be inlined with --optimize=size, because the body is larger than the call. + return NoInlineWithOz(); +} + +fn VectorizedWithOptSpeed(a: array(i32, 65536)*) { + // Should be vectorized with --optimize=speed, but not in other modes. + var n: i32 = 0; + while (n < 65536) { + (*a)[n] *= 2; + ++n; + } +} + +// CHECK:STDOUT: ; ModuleID = 'foo.carbon' +// CHECK:STDOUT: source_filename = "foo.carbon" +// CHECK:STDOUT: +// CHECK:STDOUT: declare i32 @_CRand.Main() +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: minsize nounwind optsize +// CHECK:STDOUT: define i32 @_CNoInlineWithOz.Main() #0 !dbg !4 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %Rand.call.loc7_15 = call i32 @_CRand.Main(), !dbg !7 +// CHECK:STDOUT: %Rand.call.loc7_24 = call i32 @_CRand.Main(), !dbg !8 +// CHECK:STDOUT: %Int.as.AddWith.impl.Op.call = add i32 %Rand.call.loc7_15, %Rand.call.loc7_24, !dbg !7 +// CHECK:STDOUT: ret i32 %Int.as.AddWith.impl.Op.call, !dbg !9 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: minsize nounwind optsize +// CHECK:STDOUT: define i32 @_CCallNoInlineWithOptSize.Main() #0 !dbg !10 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %NoInlineWithOz.call = call i32 @_CNoInlineWithOz.Main(), !dbg !11 +// CHECK:STDOUT: ret i32 %NoInlineWithOz.call, !dbg !12 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: minsize nounwind optsize +// CHECK:STDOUT: define void @_CVectorizedWithOptSpeed.Main(ptr %a) #0 !dbg !13 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !14 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %n.var), !dbg !14 +// CHECK:STDOUT: store i32 0, ptr %n.var, align 4, !dbg !14 +// CHECK:STDOUT: br label %while.cond, !dbg !15 +// CHECK:STDOUT: +// CHECK:STDOUT: while.cond: ; preds = %while.body, %entry +// CHECK:STDOUT: %.loc18_10 = load i32, ptr %n.var, align 4, !dbg !16 +// CHECK:STDOUT: %Int.as.OrderedWith.impl.Less.call = icmp slt i32 %.loc18_10, 65536, !dbg !16 +// CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Less.call, label %while.body, label %while.done, !dbg !15 +// CHECK:STDOUT: +// CHECK:STDOUT: while.body: ; preds = %while.cond +// CHECK:STDOUT: %.loc19_10 = load i32, ptr %n.var, align 4, !dbg !17 +// CHECK:STDOUT: %.loc19_11.array.index = getelementptr inbounds [65536 x i32], ptr %a, i32 0, i32 %.loc19_10, !dbg !18 +// CHECK:STDOUT: %Int.as.MulAssignWith.impl.Op.call = load i32, ptr %.loc19_11.array.index, align 4, !dbg !18 +// CHECK:STDOUT: %Int.as.MulAssignWith.impl.Op.call1 = mul i32 %Int.as.MulAssignWith.impl.Op.call, 2, !dbg !18 +// CHECK:STDOUT: store i32 %Int.as.MulAssignWith.impl.Op.call1, ptr %.loc19_11.array.index, align 4, !dbg !18 +// CHECK:STDOUT: call void @"_COp.Int.Core:Inc.Core.be1e879c1ad406d8"(ptr %n.var), !dbg !19 +// CHECK:STDOUT: br label %while.cond, !dbg !20 +// CHECK:STDOUT: +// CHECK:STDOUT: while.done: ; preds = %while.cond +// CHECK:STDOUT: ret void, !dbg !21 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: minsize nounwind optsize +// CHECK:STDOUT: define linkonce_odr void @"_COp.Int.Core:Inc.Core.be1e879c1ad406d8"(ptr %self) #0 !dbg !22 { +// CHECK:STDOUT: call void @"_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e"(ptr %self, i32 1), !dbg !24 +// CHECK:STDOUT: ret void, !dbg !25 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline minsize nounwind optsize +// CHECK:STDOUT: define linkonce_odr void @"_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e"(ptr %self, i32 %other) #2 !dbg !26 { +// CHECK:STDOUT: %1 = call i32 @"_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899"(i32 %other), !dbg !27 +// CHECK:STDOUT: %2 = load i32, ptr %self, align 4, !dbg !28 +// CHECK:STDOUT: %3 = add i32 %2, %1, !dbg !28 +// CHECK:STDOUT: store i32 %3, ptr %self, align 4, !dbg !28 +// CHECK:STDOUT: ret void, !dbg !28 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: minsize nounwind optsize +// CHECK:STDOUT: define linkonce_odr i32 @"_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899"(i32 %self) #0 !dbg !29 { +// CHECK:STDOUT: ret i32 %self, !dbg !31 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { minsize nounwind optsize } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { alwaysinline minsize nounwind optsize } +// CHECK:STDOUT: +// CHECK:STDOUT: !llvm.module.flags = !{!0, !1} +// CHECK:STDOUT: !llvm.dbg.cu = !{!2} +// CHECK:STDOUT: +// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5} +// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3} +// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +// CHECK:STDOUT: !3 = !DIFile(filename: "foo.carbon", directory: "") +// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "NoInlineWithOz", linkageName: "_CNoInlineWithOz.Main", scope: null, file: !3, line: 6, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !5 = !DISubroutineType(types: !6) +// CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 7, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 7, column: 19, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 7, column: 3, scope: !4) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "CallNoInlineWithOptSize", linkageName: "_CCallNoInlineWithOptSize.Main", scope: null, file: !3, line: 10, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 12, column: 10, scope: !10) +// CHECK:STDOUT: !12 = !DILocation(line: 12, column: 3, scope: !10) +// CHECK:STDOUT: !13 = distinct !DISubprogram(name: "VectorizedWithOptSpeed", linkageName: "_CVectorizedWithOptSpeed.Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !14 = !DILocation(line: 17, column: 3, scope: !13) +// CHECK:STDOUT: !15 = !DILocation(line: 18, column: 9, scope: !13) +// CHECK:STDOUT: !16 = !DILocation(line: 18, column: 10, scope: !13) +// CHECK:STDOUT: !17 = !DILocation(line: 19, column: 10, scope: !13) +// CHECK:STDOUT: !18 = !DILocation(line: 19, column: 5, scope: !13) +// CHECK:STDOUT: !19 = !DILocation(line: 20, column: 5, scope: !13) +// CHECK:STDOUT: !20 = !DILocation(line: 18, column: 3, scope: !13) +// CHECK:STDOUT: !21 = !DILocation(line: 15, column: 1, scope: !13) +// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "Op", linkageName: "_COp.Int.Core:Inc.Core.be1e879c1ad406d8", scope: null, file: !23, line: 339, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !23 = !DIFile(filename: "{{.*}}/prelude/types/int.carbon", directory: "") +// CHECK:STDOUT: !24 = !DILocation(line: 341, column: 5, scope: !22) +// CHECK:STDOUT: !25 = !DILocation(line: 339, column: 3, scope: !22) +// CHECK:STDOUT: !26 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e", scope: null, file: !23, line: 275, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !27 = !DILocation(line: 4294967295, scope: !26) +// CHECK:STDOUT: !28 = !DILocation(line: 275, column: 3, scope: !26) +// CHECK:STDOUT: !29 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899", scope: null, file: !30, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !30 = !DIFile(filename: "{{.*}}/prelude/operators/as.carbon", directory: "") +// CHECK:STDOUT: !31 = !DILocation(line: 24, column: 38, scope: !29) diff --git a/toolchain/driver/testdata/compile/optimize/optimize_speed.carbon b/toolchain/driver/testdata/compile/optimize/optimize_speed.carbon new file mode 100644 index 0000000000000..3bc3baae3c206 --- /dev/null +++ b/toolchain/driver/testdata/compile/optimize/optimize_speed.carbon @@ -0,0 +1,135 @@ +// 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 +// +// ARGS: compile --optimize=speed foo.carbon --target=x86_64-unknown-linux-gnu --phase=optimize --dump-llvm-ir --exclude-dump-file-prefix=%{core} +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/optimize/optimize_speed.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/optimize/optimize_speed.carbon + +// --- foo.carbon + +import Core library "range"; + +fn Rand() -> i32; + +fn NoInlineWithOz() -> i32 { + return Rand() + Rand(); +} + +fn CallNoInlineWithOptSize() -> i32 { + // Should not be inlined with --optimize=size, because the body is larger than the call. + return NoInlineWithOz(); +} + +fn VectorizedWithOptSpeed(a: array(i32, 65536)*) { + // Should be vectorized with --optimize=speed, but not in other modes. + var n: i32 = 0; + while (n < 65536) { + (*a)[n] *= 2; + ++n; + } +} + +// CHECK:STDOUT: ; ModuleID = 'foo.carbon' +// CHECK:STDOUT: source_filename = "foo.carbon" +// CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" +// CHECK:STDOUT: +// CHECK:STDOUT: declare i32 @_CRand.Main() local_unnamed_addr +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CNoInlineWithOz.Main() local_unnamed_addr #0 !dbg !4 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %Rand.call.loc7_15 = tail call i32 @_CRand.Main() #0, !dbg !7 +// CHECK:STDOUT: %Rand.call.loc7_24 = tail call i32 @_CRand.Main() #0, !dbg !8 +// CHECK:STDOUT: %Int.as.AddWith.impl.Op.call = add i32 %Rand.call.loc7_24, %Rand.call.loc7_15, !dbg !7 +// CHECK:STDOUT: ret i32 %Int.as.AddWith.impl.Op.call, !dbg !9 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CCallNoInlineWithOptSize.Main() local_unnamed_addr #0 !dbg !10 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %Rand.call.loc7_15.i = tail call i32 @_CRand.Main() #0, !dbg !11 +// CHECK:STDOUT: %Rand.call.loc7_24.i = tail call i32 @_CRand.Main() #0, !dbg !13 +// CHECK:STDOUT: %Int.as.AddWith.impl.Op.call.i = add i32 %Rand.call.loc7_24.i, %Rand.call.loc7_15.i, !dbg !11 +// CHECK:STDOUT: ret i32 %Int.as.AddWith.impl.Op.call.i, !dbg !14 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) +// CHECK:STDOUT: define void @_CVectorizedWithOptSpeed.Main(ptr captures(none) %a) local_unnamed_addr #1 !dbg !15 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: br label %vector.body, !dbg !16 +// CHECK:STDOUT: +// CHECK:STDOUT: vector.body: ; preds = %vector.body, %entry +// CHECK:STDOUT: %index = phi i32 [ 0, %entry ], [ %index.next.1, %vector.body ], !dbg !17 +// CHECK:STDOUT: %0 = zext nneg i32 %index to i64, !dbg !23 +// CHECK:STDOUT: %1 = getelementptr inbounds nuw i32, ptr %a, i64 %0, !dbg !23 +// CHECK:STDOUT: %2 = getelementptr inbounds nuw i8, ptr %1, i64 16, !dbg !23 +// CHECK:STDOUT: %wide.load = load <4 x i32>, ptr %1, align 4, !dbg !23 +// CHECK:STDOUT: %wide.load4 = load <4 x i32>, ptr %2, align 4, !dbg !23 +// CHECK:STDOUT: %3 = shl <4 x i32> %wide.load, splat (i32 1), !dbg !23 +// CHECK:STDOUT: %4 = shl <4 x i32> %wide.load4, splat (i32 1), !dbg !23 +// CHECK:STDOUT: store <4 x i32> %3, ptr %1, align 4, !dbg !23 +// CHECK:STDOUT: store <4 x i32> %4, ptr %2, align 4, !dbg !23 +// CHECK:STDOUT: %5 = zext nneg i32 %index to i64, !dbg !23 +// CHECK:STDOUT: %6 = getelementptr inbounds nuw i32, ptr %a, i64 %5, !dbg !23 +// CHECK:STDOUT: %7 = getelementptr inbounds nuw i8, ptr %6, i64 32, !dbg !23 +// CHECK:STDOUT: %8 = getelementptr inbounds nuw i8, ptr %6, i64 48, !dbg !23 +// CHECK:STDOUT: %wide.load.1 = load <4 x i32>, ptr %7, align 4, !dbg !23 +// CHECK:STDOUT: %wide.load4.1 = load <4 x i32>, ptr %8, align 4, !dbg !23 +// CHECK:STDOUT: %9 = shl <4 x i32> %wide.load.1, splat (i32 1), !dbg !23 +// CHECK:STDOUT: %10 = shl <4 x i32> %wide.load4.1, splat (i32 1), !dbg !23 +// CHECK:STDOUT: store <4 x i32> %9, ptr %7, align 4, !dbg !23 +// CHECK:STDOUT: store <4 x i32> %10, ptr %8, align 4, !dbg !23 +// CHECK:STDOUT: %index.next.1 = add nuw nsw i32 %index, 16, !dbg !17 +// CHECK:STDOUT: %11 = icmp eq i32 %index.next.1, 65536, !dbg !16 +// CHECK:STDOUT: br i1 %11, label %while.done, label %vector.body, !dbg !16, !llvm.loop !24 +// CHECK:STDOUT: +// CHECK:STDOUT: while.done: ; preds = %vector.body +// CHECK:STDOUT: ret void, !dbg !27 +// CHECK:STDOUT: +// CHECK:STDOUT: ; uselistorder directives +// CHECK:STDOUT: uselistorder i32 %index, { 1, 0, 2 } +// CHECK:STDOUT: uselistorder ptr %1, { 1, 2, 0 } +// CHECK:STDOUT: uselistorder ptr %2, { 1, 0 } +// CHECK:STDOUT: uselistorder ptr %8, { 1, 0 } +// CHECK:STDOUT: uselistorder i32 %index.next.1, { 1, 0 } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nofree norecurse nosync nounwind memory(argmem: readwrite) } +// CHECK:STDOUT: +// CHECK:STDOUT: !llvm.module.flags = !{!0, !1} +// CHECK:STDOUT: !llvm.dbg.cu = !{!2} +// CHECK:STDOUT: +// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5} +// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3} +// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) +// CHECK:STDOUT: !3 = !DIFile(filename: "foo.carbon", directory: "") +// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "NoInlineWithOz", linkageName: "_CNoInlineWithOz.Main", scope: null, file: !3, line: 6, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !5 = !DISubroutineType(types: !6) +// CHECK:STDOUT: !6 = !{} +// CHECK:STDOUT: !7 = !DILocation(line: 7, column: 10, scope: !4) +// CHECK:STDOUT: !8 = !DILocation(line: 7, column: 19, scope: !4) +// CHECK:STDOUT: !9 = !DILocation(line: 7, column: 3, scope: !4) +// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "CallNoInlineWithOptSize", linkageName: "_CCallNoInlineWithOptSize.Main", scope: null, file: !3, line: 10, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !11 = !DILocation(line: 7, column: 10, scope: !4, inlinedAt: !12) +// CHECK:STDOUT: !12 = distinct !DILocation(line: 12, column: 10, scope: !10) +// CHECK:STDOUT: !13 = !DILocation(line: 7, column: 19, scope: !4, inlinedAt: !12) +// CHECK:STDOUT: !14 = !DILocation(line: 12, column: 3, scope: !10) +// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "VectorizedWithOptSpeed", linkageName: "_CVectorizedWithOptSpeed.Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !16 = !DILocation(line: 18, column: 9, scope: !15) +// CHECK:STDOUT: !17 = !DILocation(line: 275, column: 3, scope: !18, inlinedAt: !20) +// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e", scope: null, file: !19, line: 275, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !19 = !DIFile(filename: "{{.*}}/prelude/types/int.carbon", directory: "") +// CHECK:STDOUT: !20 = distinct !DILocation(line: 341, column: 5, scope: !21, inlinedAt: !22) +// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "Op", linkageName: "_COp.Int.Core:Inc.Core.be1e879c1ad406d8", scope: null, file: !19, line: 339, type: !5, spFlags: DISPFlagDefinition, unit: !2) +// CHECK:STDOUT: !22 = distinct !DILocation(line: 20, column: 5, scope: !15) +// CHECK:STDOUT: !23 = !DILocation(line: 19, column: 5, scope: !15) +// CHECK:STDOUT: !24 = distinct !{!24, !25, !26} +// CHECK:STDOUT: !25 = !{!"llvm.loop.isvectorized", i32 1} +// CHECK:STDOUT: !26 = !{!"llvm.loop.unroll.runtime.disable"} +// CHECK:STDOUT: !27 = !DILocation(line: 15, column: 1, scope: !15) diff --git a/toolchain/lower/BUILD b/toolchain/lower/BUILD index ce3e1294fccf0..92b38131ed2b9 100644 --- a/toolchain/lower/BUILD +++ b/toolchain/lower/BUILD @@ -11,17 +11,27 @@ filegroup( srcs = glob(["testdata/**/*.carbon"]), ) +cc_library( + name = "options", + hdrs = ["options.h"], + deps = [ + "@llvm-project//llvm:Support", + ], +) + cc_library( name = "lower", srcs = ["lower.cpp"], hdrs = ["lower.h"], deps = [ ":context", + ":options", "//common:vlog", "//toolchain/parse:tree", "//toolchain/sem_ir:file", "//toolchain/sem_ir:inst_namer", "@llvm-project//llvm:Core", + "@llvm-project//llvm:Passes", "@llvm-project//llvm:Support", ], ) @@ -51,6 +61,7 @@ cc_library( "specific_coalescer.h", ], deps = [ + ":options", "//common:check", "//common:growing_range", "//common:map", @@ -75,6 +86,7 @@ cc_library( "@llvm-project//clang:lex", "@llvm-project//llvm:Core", "@llvm-project//llvm:Linker", + "@llvm-project//llvm:Passes", "@llvm-project//llvm:Support", "@llvm-project//llvm:TransformUtils", ], diff --git a/toolchain/lower/context.cpp b/toolchain/lower/context.cpp index e58e1a3805b63..0101af49e14c9 100644 --- a/toolchain/lower/context.cpp +++ b/toolchain/lower/context.cpp @@ -19,10 +19,11 @@ Context::Context( llvm::IntrusiveRefCntPtr fs, bool want_debug_info, const Parse::GetTreeAndSubtreesStore* tree_and_subtrees_getters, llvm::StringRef module_name, int total_ir_count, - llvm::raw_ostream* vlog_stream) + Lower::OptimizationLevel opt_level, llvm::raw_ostream* vlog_stream) : llvm_context_(llvm_context), llvm_module_(std::make_unique(module_name, *llvm_context)), file_system_(std::move(fs)), + opt_level_(opt_level), di_builder_(*llvm_module_), di_compile_unit_( want_debug_info diff --git a/toolchain/lower/context.h b/toolchain/lower/context.h index 520467560cb04..ecdb09ba37761 100644 --- a/toolchain/lower/context.h +++ b/toolchain/lower/context.h @@ -14,6 +14,7 @@ #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" #include "toolchain/base/fixed_size_value_store.h" +#include "toolchain/lower/options.h" #include "toolchain/parse/tree_and_subtrees.h" #include "toolchain/sem_ir/absolute_node_id.h" #include "toolchain/sem_ir/ids.h" @@ -49,7 +50,7 @@ class Context { llvm::IntrusiveRefCntPtr fs, bool want_debug_info, const Parse::GetTreeAndSubtreesStore* tree_and_subtrees_getters, llvm::StringRef module_name, int total_ir_count, - llvm::raw_ostream* vlog_stream); + Lower::OptimizationLevel opt_level, llvm::raw_ostream* vlog_stream); // Gets or creates the `FileContext` for a given SemIR file. If an // `inst_namer` is specified the first time this is called for a file, it will @@ -97,6 +98,7 @@ class Context { auto file_system() -> llvm::IntrusiveRefCntPtr& { return file_system_; } + auto opt_level() -> Lower::OptimizationLevel { return opt_level_; } auto di_builder() -> llvm::DIBuilder& { return di_builder_; } auto di_compile_unit() -> llvm::DICompileUnit* { return di_compile_unit_; } auto tree_and_subtrees_getters() -> const Parse::GetTreeAndSubtreesStore& { @@ -130,6 +132,9 @@ class Context { // The filesystem for source code. llvm::IntrusiveRefCntPtr file_system_; + // The optimization level to specify for lowered function definitions. + Lower::OptimizationLevel opt_level_; + // State for building the LLVM IR debug info metadata. llvm::DIBuilder di_builder_; diff --git a/toolchain/lower/file_context.cpp b/toolchain/lower/file_context.cpp index cc808f4f477bc..50b7f57937d81 100644 --- a/toolchain/lower/file_context.cpp +++ b/toolchain/lower/file_context.cpp @@ -23,6 +23,7 @@ #include "toolchain/lower/constant.h" #include "toolchain/lower/function_context.h" #include "toolchain/lower/mangler.h" +#include "toolchain/lower/options.h" #include "toolchain/lower/specific_coalescer.h" #include "toolchain/sem_ir/absolute_node_id.h" #include "toolchain/sem_ir/diagnostic_loc_converter.h" @@ -619,6 +620,36 @@ auto FileContext::BuildFunctionBody(SemIR::FunctionId function_id, AddLoweredSpecificForGeneric(declaration_function.generic_id, specific_id); } + // Set attributes on the function definition. + { + llvm::AttrBuilder attr_builder(llvm_context()); + attr_builder.addAttribute(llvm::Attribute::NoUnwind); + + // TODO: We should take the opt level from the SemIR file; it might not be + // the same for all files in a compilation. + if (context().opt_level() == Lower::OptimizationLevel::None) { + // --optimize=none disables all optimizations for this function. + attr_builder.addAttribute(llvm::Attribute::OptimizeNone); + attr_builder.addAttribute(llvm::Attribute::NoInline); + } else { + // Otherwise, always inline thunks. + if (definition_function.special_function_kind == + SemIR::Function::SpecialFunctionKind::Thunk) { + attr_builder.addAttribute(llvm::Attribute::AlwaysInline); + } + + // Convert --optimize=size into optsize and minsize. + if (context().opt_level() == Lower::OptimizationLevel::Size) { + attr_builder.addAttribute(llvm::Attribute::OptimizeForSize); + attr_builder.addAttribute(llvm::Attribute::MinSize); + } + + // TODO: Should we generate an InlineHint for some functions? Perhaps for + // those defined in the API file? + } + llvm_function->addFnAttrs(attr_builder); + } + FunctionContext function_lowering( definition_context, llvm_function, *this, specific_id, coalescer_.InitializeFingerprintForSpecific(specific_id), diff --git a/toolchain/lower/lower.cpp b/toolchain/lower/lower.cpp index ace02fad8d14a..5a1ce01a85390 100644 --- a/toolchain/lower/lower.cpp +++ b/toolchain/lower/lower.cpp @@ -22,7 +22,7 @@ auto LowerToLLVM( const LowerToLLVMOptions& options) -> std::unique_ptr { Context context(&llvm_context, std::move(fs), options.want_debug_info, &tree_and_subtrees_getters, sem_ir.filename(), total_ir_count, - options.vlog_stream); + options.opt_level, options.vlog_stream); // TODO: Consider disabling instruction naming by default if we're not // producing textual LLVM IR. @@ -37,10 +37,6 @@ auto LowerToLLVM( /*ShouldPreserveUseListOrder=*/false, /*IsForDebug=*/true); } - if (options.dump_stream) { - module->print(*options.dump_stream, /*AAW=*/nullptr, - /*ShouldPreserveUseListOrder=*/true); - } if (options.llvm_verifier_stream) { CARBON_CHECK(!llvm::verifyModule(*module, options.llvm_verifier_stream)); diff --git a/toolchain/lower/lower.h b/toolchain/lower/lower.h index 189820df87ab0..1fa6df3c537a7 100644 --- a/toolchain/lower/lower.h +++ b/toolchain/lower/lower.h @@ -8,29 +8,13 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" +#include "toolchain/lower/options.h" #include "toolchain/parse/tree_and_subtrees.h" #include "toolchain/sem_ir/file.h" #include "toolchain/sem_ir/inst_namer.h" namespace Carbon::Lower { -struct LowerToLLVMOptions { - // Options must be set individually, not through initialization. - explicit LowerToLLVMOptions() = default; - - // If set, enables LLVM IR verification. - llvm::raw_ostream* llvm_verifier_stream = nullptr; - - // Whether to include debug info in lowered output. - bool want_debug_info = false; - - // If set, enables verbose output. - llvm::raw_ostream* vlog_stream = nullptr; - - // If set, LLVM IR will be dumped to this in textual form. - llvm::raw_ostream* dump_stream = nullptr; -}; - // Lowers SemIR to LLVM IR. auto LowerToLLVM( llvm::LLVMContext& llvm_context, diff --git a/toolchain/lower/options.h b/toolchain/lower/options.h new file mode 100644 index 0000000000000..8a1a8d8227685 --- /dev/null +++ b/toolchain/lower/options.h @@ -0,0 +1,44 @@ +// 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 + +#ifndef CARBON_TOOLCHAIN_LOWER_OPTIONS_H_ +#define CARBON_TOOLCHAIN_LOWER_OPTIONS_H_ + +#include "llvm/Support/raw_ostream.h" + +namespace Carbon::Lower { + +enum class OptimizationLevel { + // No optimizations beyond necessary ones like inlining always-inline + // functions. Corresponds to Clang -O0. + None, + // Perform optimizations that make the build faster and don't degrade + // debugging. Corresponds to Clang -O1 or -Og. + Debug, + // Optimize for binary size. Corresponds to Clang -Oz. + Size, + // Optimize for program execution speed. Corresponds to Clang -O3. + Speed, +}; + +struct LowerToLLVMOptions { + // Options must be set individually, not through initialization. + explicit LowerToLLVMOptions() = default; + + // If set, enables LLVM IR verification. + llvm::raw_ostream* llvm_verifier_stream = nullptr; + + // Whether to include debug info in lowered output. + bool want_debug_info = false; + + // If set, enables verbose output. + llvm::raw_ostream* vlog_stream = nullptr; + + // The optimization level to set on lowered functions by default. + OptimizationLevel opt_level = OptimizationLevel::Debug; +}; + +} // namespace Carbon::Lower + +#endif // CARBON_TOOLCHAIN_LOWER_OPTIONS_H_ diff --git a/toolchain/lower/testdata/alias/local.carbon b/toolchain/lower/testdata/alias/local.carbon index ab64fc98f3b51..b74ad75f6b1d1 100644 --- a/toolchain/lower/testdata/alias/local.carbon +++ b/toolchain/lower/testdata/alias/local.carbon @@ -19,7 +19,8 @@ fn F() -> i32 { // CHECK:STDOUT: ; ModuleID = 'local.carbon' // CHECK:STDOUT: source_filename = "local.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca i32, align 4, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %a.var), !dbg !7 @@ -29,9 +30,10 @@ fn F() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/array/array_in_place.carbon b/toolchain/lower/testdata/array/array_in_place.carbon index 3e1c36e311e32..a24c1061b7410 100644 --- a/toolchain/lower/testdata/array/array_in_place.carbon +++ b/toolchain/lower/testdata/array/array_in_place.carbon @@ -21,7 +21,8 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CF.Main(ptr sret({ i32, i32, i32 })) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CG.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CG.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %v.var = alloca [2 x { i32, i32, i32 }], align 8, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %v.var), !dbg !7 @@ -33,9 +34,10 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/array/assign_return_value.carbon b/toolchain/lower/testdata/array/assign_return_value.carbon index 9317793820a08..b9721574bd8e1 100644 --- a/toolchain/lower/testdata/array/assign_return_value.carbon +++ b/toolchain/lower/testdata/array/assign_return_value.carbon @@ -21,7 +21,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: @tuple.loc13_39 = internal constant { i32, i32 } { i32 12, i32 24 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main(ptr sret({ i32, i32 }) %return) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main(ptr sret({ i32, i32 }) %return) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %tuple.elem0.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %tuple.elem1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7 @@ -29,7 +30,8 @@ fn Run() { // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @main() !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @main() #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %t.var = alloca [2 x i32], align 4, !dbg !10 // CHECK:STDOUT: %.loc16_28.1.temp = alloca { i32, i32 }, align 8, !dbg !11 @@ -48,16 +50,17 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/array/base.carbon b/toolchain/lower/testdata/array/base.carbon index b1575c85addfd..cb366808e49ee 100644 --- a/toolchain/lower/testdata/array/base.carbon +++ b/toolchain/lower/testdata/array/base.carbon @@ -26,7 +26,8 @@ fn Run() { // CHECK:STDOUT: @array.1cb.loc16_3 = internal constant [5 x {}] zeroinitializer // CHECK:STDOUT: @tuple.loc17_3 = internal constant { i32, i32, i32 } { i32 1, i32 2, i32 3 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca [1 x i32], align 4, !dbg !7 // CHECK:STDOUT: %b.var = alloca [2 x double], align 8, !dbg !8 @@ -69,17 +70,18 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 4, 3, 2, 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/array/field.carbon b/toolchain/lower/testdata/array/field.carbon index 106b19dec8881..9dab97495ef85 100644 --- a/toolchain/lower/testdata/array/field.carbon +++ b/toolchain/lower/testdata/array/field.carbon @@ -30,7 +30,8 @@ class A { // CHECK:STDOUT: // CHECK:STDOUT: @A.val.loc16_40 = internal constant { [2 x i32] } { [2 x i32] [i32 1, i32 2] } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CInit.A.Main(ptr sret({ [2 x i32] }) %return) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CInit.A.Main(ptr sret({ [2 x i32] }) %return) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc16_39.2.v = getelementptr inbounds nuw { [2 x i32] }, ptr %return, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %.loc16_38.3.array.index = getelementptr inbounds [2 x i32], ptr %.loc16_39.2.v, i32 0, i64 0, !dbg !8 @@ -39,7 +40,8 @@ class A { // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CAccess.A.Main(ptr %self) !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CAccess.A.Main(ptr %self) #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc19_16.1.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !11 // CHECK:STDOUT: %.loc19_20.2.array.index = getelementptr inbounds [2 x i32], ptr %.loc19_16.1.v, i32 0, i32 0, !dbg !11 @@ -47,7 +49,8 @@ class A { // CHECK:STDOUT: ret i32 %.loc19_20.3, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CUse.A.Main(ptr %self) !dbg !13 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CUse.A.Main(ptr %self) #0 !dbg !13 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc23_9.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !14 // CHECK:STDOUT: %.loc23_13.array.index = getelementptr inbounds [2 x i32], ptr %.loc23_9.v, i32 0, i32 0, !dbg !14 @@ -59,9 +62,10 @@ class A { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/array/field_addr.carbon b/toolchain/lower/testdata/array/field_addr.carbon index dbe1fbd9f284e..2bc991bc7ec0e 100644 --- a/toolchain/lower/testdata/array/field_addr.carbon +++ b/toolchain/lower/testdata/array/field_addr.carbon @@ -30,7 +30,8 @@ class A { // CHECK:STDOUT: // CHECK:STDOUT: @A.val.loc16_40 = internal constant { [2 x i32] } { [2 x i32] [i32 1, i32 2] } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CInit.A.Main(ptr sret({ [2 x i32] }) %return) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CInit.A.Main(ptr sret({ [2 x i32] }) %return) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc16_39.2.v = getelementptr inbounds nuw { [2 x i32] }, ptr %return, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %.loc16_38.3.array.index = getelementptr inbounds [2 x i32], ptr %.loc16_39.2.v, i32 0, i64 0, !dbg !8 @@ -39,7 +40,8 @@ class A { // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CAccess.A.Main(ptr %self) !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CAccess.A.Main(ptr %self) #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc19_16.1.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !11 // CHECK:STDOUT: %.loc19_20.2.array.index = getelementptr inbounds [2 x i32], ptr %.loc19_16.1.v, i32 0, i32 0, !dbg !11 @@ -47,7 +49,8 @@ class A { // CHECK:STDOUT: ret i32 %.loc19_20.3, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CUse.A.Main(ptr %self) !dbg !13 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CUse.A.Main(ptr %self) #0 !dbg !13 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc23_9.2.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !14 // CHECK:STDOUT: %.loc23_14.array.index = getelementptr inbounds [2 x i32], ptr %.loc23_9.2.v, i32 0, i32 0, !dbg !14 @@ -59,9 +62,10 @@ class A { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/array/function_param.carbon b/toolchain/lower/testdata/array/function_param.carbon index 2be12f8347c77..f88c436f142f6 100644 --- a/toolchain/lower/testdata/array/function_param.carbon +++ b/toolchain/lower/testdata/array/function_param.carbon @@ -23,14 +23,16 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: @array.loc18_20.13 = internal constant [3 x i32] [i32 1, i32 2, i32 3] // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CF.Main(ptr %arr, i32 %i) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CF.Main(ptr %arr, i32 %i) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc14_15.2.array.index = getelementptr inbounds [3 x i32], ptr %arr, i32 0, i32 %i, !dbg !7 // CHECK:STDOUT: %.loc14_15.3 = load i32, ptr %.loc14_15.2.array.index, align 4, !dbg !7 // CHECK:STDOUT: ret i32 %.loc14_15.3, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CG.Main() !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CG.Main() #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc18_20.3.temp = alloca [3 x i32], align 4, !dbg !10 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc18_20.3.temp), !dbg !10 @@ -43,13 +45,14 @@ fn G() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/array/iterate.carbon b/toolchain/lower/testdata/array/iterate.carbon index c235dcefef1ed..81f328e573282 100644 --- a/toolchain/lower/testdata/array/iterate.carbon +++ b/toolchain/lower/testdata/array/iterate.carbon @@ -26,7 +26,8 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CG.Main(i32) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc16_43.3.temp = alloca [6 x i32], align 4, !dbg !7 // CHECK:STDOUT: %var = alloca i32, align 4, !dbg !8 @@ -60,16 +61,18 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @"_CNewCursor.f06e388f4a5bd5ec:Iterate.Core.a21f6adcc8abe06c"(ptr %self) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @"_CNewCursor.f06e388f4a5bd5ec:Iterate.Core.a21f6adcc8abe06c"(ptr %self) #0 !dbg !12 { // CHECK:STDOUT: ret i32 0, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CNext.f06e388f4a5bd5ec:Iterate.Core.a21f6adcc8abe06c"(ptr sret({ i32, i1 }) %return, ptr %self, ptr %cursor) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CNext.f06e388f4a5bd5ec:Iterate.Core.a21f6adcc8abe06c"(ptr sret({ i32, i1 }) %return, ptr %self, ptr %cursor) #0 !dbg !15 { // CHECK:STDOUT: %1 = load i32, ptr %cursor, align 4, !dbg !16 // CHECK:STDOUT: %2 = icmp slt i32 %1, 6, !dbg !16 // CHECK:STDOUT: br i1 %2, label %3, label %7, !dbg !17 @@ -88,45 +91,53 @@ fn F() { // CHECK:STDOUT: ret void, !dbg !24 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i1 @_CHasValue.Optional.Core.c1b882a73b8b9531(ptr %self) !dbg !25 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i1 @_CHasValue.Optional.Core.c1b882a73b8b9531(ptr %self) #0 !dbg !25 { // CHECK:STDOUT: %1 = call i1 @"_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %self), !dbg !27 // CHECK:STDOUT: ret i1 %1, !dbg !28 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CGet.Optional.Core.c1b882a73b8b9531(ptr %self) !dbg !29 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CGet.Optional.Core.c1b882a73b8b9531(ptr %self) #0 !dbg !29 { // CHECK:STDOUT: %1 = call i32 @"_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %self), !dbg !30 // CHECK:STDOUT: ret i32 %1, !dbg !31 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_COp.Int.Core:Inc.Core.be1e879c1ad406d8"(ptr %self) !dbg !32 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_COp.Int.Core:Inc.Core.be1e879c1ad406d8"(ptr %self) #0 !dbg !32 { // CHECK:STDOUT: call void @"_COp:thunk.Int.Core:AddAssignWith.Core.dbc952efa35fc763"(ptr %self, i32 1), !dbg !34 // CHECK:STDOUT: ret void, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CSome.Optional.Core.c1b882a73b8b9531(ptr sret({ i32, i1 }) %return, i32 %value) !dbg !36 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CSome.Optional.Core.c1b882a73b8b9531(ptr sret({ i32, i1 }) %return, i32 %value) #0 !dbg !36 { // CHECK:STDOUT: call void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %return, i32 %value), !dbg !37 // CHECK:STDOUT: ret void, !dbg !38 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CNone.Optional.Core.c1b882a73b8b9531(ptr sret({ i32, i1 }) %return) !dbg !39 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CNone.Optional.Core.c1b882a73b8b9531(ptr sret({ i32, i1 }) %return) #0 !dbg !39 { // CHECK:STDOUT: call void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %return), !dbg !40 // CHECK:STDOUT: ret void, !dbg !41 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i1 @"_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %value) !dbg !42 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i1 @"_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %value) #0 !dbg !42 { // CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %value, i32 0, i32 1, !dbg !43 // CHECK:STDOUT: %1 = load i8, ptr %has_value, align 1, !dbg !43 // CHECK:STDOUT: %2 = trunc i8 %1 to i1, !dbg !43 // CHECK:STDOUT: ret i1 %2, !dbg !44 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @"_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %value) !dbg !45 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @"_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %value) #0 !dbg !45 { // CHECK:STDOUT: %value1 = getelementptr inbounds nuw { i32, i1 }, ptr %value, i32 0, i32 0, !dbg !46 // CHECK:STDOUT: %1 = load i32, ptr %value1, align 4, !dbg !46 // CHECK:STDOUT: ret i32 %1, !dbg !47 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_COp:thunk.Int.Core:AddAssignWith.Core.dbc952efa35fc763"(ptr %self, i32 %other) !dbg !48 { +// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind +// CHECK:STDOUT: define linkonce_odr void @"_COp:thunk.Int.Core:AddAssignWith.Core.dbc952efa35fc763"(ptr %self, i32 %other) #3 !dbg !48 { // CHECK:STDOUT: %1 = call i32 @"_CConvert.02bbc8f98b95ea6d:ImplicitAs.Core.5854fed63e66a74b"(i32 %other), !dbg !49 // CHECK:STDOUT: %2 = load i32, ptr %self, align 4, !dbg !50 // CHECK:STDOUT: %3 = add i32 %2, %1, !dbg !50 @@ -134,7 +145,8 @@ fn F() { // CHECK:STDOUT: ret void, !dbg !50 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return, i32 %self) !dbg !51 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !51 { // CHECK:STDOUT: %value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 0, !dbg !52 // CHECK:STDOUT: store i32 %self, ptr %value, align 4, !dbg !52 // CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 1, !dbg !53 @@ -142,21 +154,25 @@ fn F() { // CHECK:STDOUT: ret void, !dbg !54 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return) !dbg !55 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return) #0 !dbg !55 { // CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 1, !dbg !56 // CHECK:STDOUT: store i8 0, ptr %has_value, align 1, !dbg !56 // CHECK:STDOUT: ret void, !dbg !57 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @"_CConvert.02bbc8f98b95ea6d:ImplicitAs.Core.5854fed63e66a74b"(i32 %self) !dbg !58 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @"_CConvert.02bbc8f98b95ea6d:ImplicitAs.Core.5854fed63e66a74b"(i32 %self) #0 !dbg !58 { // CHECK:STDOUT: ret i32 %self, !dbg !60 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #3 = { alwaysinline nounwind } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/builtins/bool.carbon b/toolchain/lower/testdata/builtins/bool.carbon index 4d89fbc6391b4..920d20af82c11 100644 --- a/toolchain/lower/testdata/builtins/bool.carbon +++ b/toolchain/lower/testdata/builtins/bool.carbon @@ -26,19 +26,22 @@ fn IfEq(a: Bool(), b: Bool()) -> Bool() { // CHECK:STDOUT: ; ModuleID = 'bool.carbon' // CHECK:STDOUT: source_filename = "bool.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestEq.Main(i1 %a, i1 %b) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestEq.Main(i1 %a, i1 %b) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Eq.call = icmp eq i1 %a, %b, !dbg !7 // CHECK:STDOUT: ret i1 %Eq.call, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestNeq.Main(i1 %a, i1 %b) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestNeq.Main(i1 %a, i1 %b) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Neq.call = icmp ne i1 %a, %b, !dbg !10 // CHECK:STDOUT: ret i1 %Neq.call, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CIfEq.Main(i1 %a, i1 %b) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CIfEq.Main(i1 %a, i1 %b) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Eq.call = icmp eq i1 %a, %b, !dbg !13 // CHECK:STDOUT: br i1 %Eq.call, label %if.then, label %if.else, !dbg !14 @@ -50,6 +53,8 @@ fn IfEq(a: Bool(), b: Bool()) -> Bool() { // CHECK:STDOUT: ret i1 false, !dbg !16 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/builtins/char.carbon b/toolchain/lower/testdata/builtins/char.carbon index 81cb62a2fc7eb..b8adb996e2f2e 100644 --- a/toolchain/lower/testdata/builtins/char.carbon +++ b/toolchain/lower/testdata/builtins/char.carbon @@ -22,7 +22,8 @@ fn Example() -> char { // CHECK:STDOUT: ; ModuleID = 'basic.carbon' // CHECK:STDOUT: source_filename = "basic.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i8 @_CExample.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i8 @_CExample.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c.var = alloca i8, align 1, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !7 @@ -32,9 +33,10 @@ fn Example() -> char { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/builtins/float.carbon b/toolchain/lower/testdata/builtins/float.carbon index c410658828d12..f5883ae9499e3 100644 --- a/toolchain/lower/testdata/builtins/float.carbon +++ b/toolchain/lower/testdata/builtins/float.carbon @@ -82,72 +82,85 @@ fn TestF128(a: f128, b: f128) -> f128 { return F128(a, b); } // CHECK:STDOUT: ; ModuleID = 'basic.carbon' // CHECK:STDOUT: source_filename = "basic.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define double @_CTestNegate.Main(double %a) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define double @_CTestNegate.Main(double %a) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Negate.call = fneg double %a, !dbg !7 // CHECK:STDOUT: ret double %Negate.call, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define double @_CTestAdd.Main(double %a, double %b) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define double @_CTestAdd.Main(double %a, double %b) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Add.call = fadd double %a, %b, !dbg !10 // CHECK:STDOUT: ret double %Add.call, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define double @_CTestSub.Main(double %a, double %b) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define double @_CTestSub.Main(double %a, double %b) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Sub.call = fsub double %a, %b, !dbg !13 // CHECK:STDOUT: ret double %Sub.call, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define double @_CTestMul.Main(double %a, double %b) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define double @_CTestMul.Main(double %a, double %b) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Mul.call = fmul double %a, %b, !dbg !16 // CHECK:STDOUT: ret double %Mul.call, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define double @_CTestDiv.Main(double %a, double %b) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define double @_CTestDiv.Main(double %a, double %b) #0 !dbg !18 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Div.call = fdiv double %a, %b, !dbg !19 // CHECK:STDOUT: ret double %Div.call, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestEq.Main(double %a, double %b) !dbg !21 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestEq.Main(double %a, double %b) #0 !dbg !21 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Eq.call = fcmp oeq double %a, %b, !dbg !22 // CHECK:STDOUT: ret i1 %Eq.call, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestNeq.Main(double %a, double %b) !dbg !24 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestNeq.Main(double %a, double %b) #0 !dbg !24 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Neq.call = fcmp one double %a, %b, !dbg !25 // CHECK:STDOUT: ret i1 %Neq.call, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestLess.Main(double %a, double %b) !dbg !27 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestLess.Main(double %a, double %b) #0 !dbg !27 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Less.call = fcmp olt double %a, %b, !dbg !28 // CHECK:STDOUT: ret i1 %Less.call, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestLessEq.Main(double %a, double %b) !dbg !30 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestLessEq.Main(double %a, double %b) #0 !dbg !30 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %LessEq.call = fcmp ole double %a, %b, !dbg !31 // CHECK:STDOUT: ret i1 %LessEq.call, !dbg !32 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestGreater.Main(double %a, double %b) !dbg !33 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestGreater.Main(double %a, double %b) #0 !dbg !33 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Greater.call = fcmp ogt double %a, %b, !dbg !34 // CHECK:STDOUT: ret i1 %Greater.call, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestGreaterEq.Main(double %a, double %b) !dbg !36 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestGreaterEq.Main(double %a, double %b) #0 !dbg !36 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %GreaterEq.call = fcmp oge double %a, %b, !dbg !37 // CHECK:STDOUT: ret i1 %GreaterEq.call, !dbg !38 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -193,7 +206,8 @@ fn TestF128(a: f128, b: f128) -> f128 { return F128(a, b); } // CHECK:STDOUT: ; ModuleID = 'compound_assign.carbon' // CHECK:STDOUT: source_filename = "compound_assign.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestAdd.Main(ptr %a, double %b) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestAdd.Main(ptr %a, double %b) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Add.call = load double, ptr %a, align 8, !dbg !7 // CHECK:STDOUT: %Add.call1 = fadd double %Add.call, %b, !dbg !7 @@ -201,7 +215,8 @@ fn TestF128(a: f128, b: f128) -> f128 { return F128(a, b); } // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestSub.Main(ptr %a, double %b) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestSub.Main(ptr %a, double %b) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Sub.call = load double, ptr %a, align 8, !dbg !10 // CHECK:STDOUT: %Sub.call1 = fsub double %Sub.call, %b, !dbg !10 @@ -209,7 +224,8 @@ fn TestF128(a: f128, b: f128) -> f128 { return F128(a, b); } // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestMul.Main(ptr %a, double %b) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestMul.Main(ptr %a, double %b) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Mul.call = load double, ptr %a, align 8, !dbg !13 // CHECK:STDOUT: %Mul.call1 = fmul double %Mul.call, %b, !dbg !13 @@ -217,7 +233,8 @@ fn TestF128(a: f128, b: f128) -> f128 { return F128(a, b); } // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestDiv.Main(ptr %a, double %b) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestDiv.Main(ptr %a, double %b) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Div.call = load double, ptr %a, align 8, !dbg !16 // CHECK:STDOUT: %Div.call1 = fdiv double %Div.call, %b, !dbg !16 @@ -225,6 +242,8 @@ fn TestF128(a: f128, b: f128) -> f128 { return F128(a, b); } // CHECK:STDOUT: ret void, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -249,30 +268,36 @@ fn TestF128(a: f128, b: f128) -> f128 { return F128(a, b); } // CHECK:STDOUT: ; ModuleID = 'types.carbon' // CHECK:STDOUT: source_filename = "types.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define half @_CTestF16.Main(half %a, half %b) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define half @_CTestF16.Main(half %a, half %b) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %F16.call = fadd half %a, %b, !dbg !7 // CHECK:STDOUT: ret half %F16.call, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define float @_CTestF32.Main(float %a, float %b) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define float @_CTestF32.Main(float %a, float %b) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %F32.call = fadd float %a, %b, !dbg !10 // CHECK:STDOUT: ret float %F32.call, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define double @_CTestF64.Main(double %a, double %b) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define double @_CTestF64.Main(double %a, double %b) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %F64.call = fadd double %a, %b, !dbg !13 // CHECK:STDOUT: ret double %F64.call, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define fp128 @_CTestF128.Main(fp128 %a, fp128 %b) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define fp128 @_CTestF128.Main(fp128 %a, fp128 %b) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %F128.call = fadd fp128 %a, %b, !dbg !16 // CHECK:STDOUT: ret fp128 %F128.call, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/builtins/int.carbon b/toolchain/lower/testdata/builtins/int.carbon index e7503e2128a74..5c27cd7b180a2 100644 --- a/toolchain/lower/testdata/builtins/int.carbon +++ b/toolchain/lower/testdata/builtins/int.carbon @@ -225,120 +225,141 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ; ModuleID = 'basic.carbon' // CHECK:STDOUT: source_filename = "basic.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestNegate.Main(i32 %a) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestNegate.Main(i32 %a) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Negate.call = sub i32 0, %a, !dbg !7 // CHECK:STDOUT: ret i32 %Negate.call, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestAdd.Main(i32 %a, i32 %b) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestAdd.Main(i32 %a, i32 %b) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Add.call = add i32 %a, %b, !dbg !10 // CHECK:STDOUT: ret i32 %Add.call, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestSub.Main(i32 %a, i32 %b) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestSub.Main(i32 %a, i32 %b) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Sub.call = sub i32 %a, %b, !dbg !13 // CHECK:STDOUT: ret i32 %Sub.call, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestMul.Main(i32 %a, i32 %b) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestMul.Main(i32 %a, i32 %b) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Mul.call = mul i32 %a, %b, !dbg !16 // CHECK:STDOUT: ret i32 %Mul.call, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestDiv.Main(i32 %a, i32 %b) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestDiv.Main(i32 %a, i32 %b) #0 !dbg !18 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Div.call = sdiv i32 %a, %b, !dbg !19 // CHECK:STDOUT: ret i32 %Div.call, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestMod.Main(i32 %a, i32 %b) !dbg !21 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestMod.Main(i32 %a, i32 %b) #0 !dbg !21 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Mod.call = srem i32 %a, %b, !dbg !22 // CHECK:STDOUT: ret i32 %Mod.call, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestComplement.Main(i32 %a) !dbg !24 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestComplement.Main(i32 %a) #0 !dbg !24 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Complement.call = xor i32 -1, %a, !dbg !25 // CHECK:STDOUT: ret i32 %Complement.call, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestAnd.Main(i32 %a, i32 %b) !dbg !27 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestAnd.Main(i32 %a, i32 %b) #0 !dbg !27 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %And.call = and i32 %a, %b, !dbg !28 // CHECK:STDOUT: ret i32 %And.call, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestOr.Main(i32 %a, i32 %b) !dbg !30 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestOr.Main(i32 %a, i32 %b) #0 !dbg !30 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Or.call = or i32 %a, %b, !dbg !31 // CHECK:STDOUT: ret i32 %Or.call, !dbg !32 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestXor.Main(i32 %a, i32 %b) !dbg !33 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestXor.Main(i32 %a, i32 %b) #0 !dbg !33 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Xor.call = xor i32 %a, %b, !dbg !34 // CHECK:STDOUT: ret i32 %Xor.call, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestLeftShift.Main(i32 %a, i32 %b) !dbg !36 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestLeftShift.Main(i32 %a, i32 %b) #0 !dbg !36 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %LeftShift.call = shl i32 %a, %b, !dbg !37 // CHECK:STDOUT: ret i32 %LeftShift.call, !dbg !38 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestArithmeticRightShift.Main(i32 %a, i32 %b) !dbg !39 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestArithmeticRightShift.Main(i32 %a, i32 %b) #0 !dbg !39 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ArithmeticRightShift.call = ashr i32 %a, %b, !dbg !40 // CHECK:STDOUT: ret i32 %ArithmeticRightShift.call, !dbg !41 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestLogicalRightShift.Main(i32 %a, i32 %b) !dbg !42 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestLogicalRightShift.Main(i32 %a, i32 %b) #0 !dbg !42 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %LogicalRightShift.call = lshr i32 %a, %b, !dbg !43 // CHECK:STDOUT: ret i32 %LogicalRightShift.call, !dbg !44 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestEq.Main(i32 %a, i32 %b) !dbg !45 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestEq.Main(i32 %a, i32 %b) #0 !dbg !45 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Eq.call = icmp eq i32 %a, %b, !dbg !46 // CHECK:STDOUT: ret i1 %Eq.call, !dbg !47 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestNeq.Main(i32 %a, i32 %b) !dbg !48 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestNeq.Main(i32 %a, i32 %b) #0 !dbg !48 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Neq.call = icmp ne i32 %a, %b, !dbg !49 // CHECK:STDOUT: ret i1 %Neq.call, !dbg !50 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestLess.Main(i32 %a, i32 %b) !dbg !51 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestLess.Main(i32 %a, i32 %b) #0 !dbg !51 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Less.call = icmp slt i32 %a, %b, !dbg !52 // CHECK:STDOUT: ret i1 %Less.call, !dbg !53 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestLessEq.Main(i32 %a, i32 %b) !dbg !54 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestLessEq.Main(i32 %a, i32 %b) #0 !dbg !54 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %LessEq.call = icmp sle i32 %a, %b, !dbg !55 // CHECK:STDOUT: ret i1 %LessEq.call, !dbg !56 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestGreater.Main(i32 %a, i32 %b) !dbg !57 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestGreater.Main(i32 %a, i32 %b) #0 !dbg !57 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Greater.call = icmp sgt i32 %a, %b, !dbg !58 // CHECK:STDOUT: ret i1 %Greater.call, !dbg !59 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestGreaterEq.Main(i32 %a, i32 %b) !dbg !60 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestGreaterEq.Main(i32 %a, i32 %b) #0 !dbg !60 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %GreaterEq.call = icmp sge i32 %a, %b, !dbg !61 // CHECK:STDOUT: ret i1 %GreaterEq.call, !dbg !62 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -408,7 +429,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ; ModuleID = 'compound_assign.carbon' // CHECK:STDOUT: source_filename = "compound_assign.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestSAdd.Main(ptr %a, i32 %b) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestSAdd.Main(ptr %a, i32 %b) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %SAdd.call = load i32, ptr %a, align 4, !dbg !7 // CHECK:STDOUT: %SAdd.call1 = add i32 %SAdd.call, %b, !dbg !7 @@ -416,7 +438,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestSSub.Main(ptr %a, i32 %b) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestSSub.Main(ptr %a, i32 %b) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %SSub.call = load i32, ptr %a, align 4, !dbg !10 // CHECK:STDOUT: %SSub.call1 = sub i32 %SSub.call, %b, !dbg !10 @@ -424,7 +447,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestSMul.Main(ptr %a, i32 %b) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestSMul.Main(ptr %a, i32 %b) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %SMul.call = load i32, ptr %a, align 4, !dbg !13 // CHECK:STDOUT: %SMul.call1 = mul i32 %SMul.call, %b, !dbg !13 @@ -432,7 +456,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestSDiv.Main(ptr %a, i32 %b) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestSDiv.Main(ptr %a, i32 %b) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %SDiv.call = load i32, ptr %a, align 4, !dbg !16 // CHECK:STDOUT: %SDiv.call1 = sdiv i32 %SDiv.call, %b, !dbg !16 @@ -440,7 +465,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret void, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestSMod.Main(ptr %a, i32 %b) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestSMod.Main(ptr %a, i32 %b) #0 !dbg !18 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %SMod.call = load i32, ptr %a, align 4, !dbg !19 // CHECK:STDOUT: %SMod.call1 = srem i32 %SMod.call, %b, !dbg !19 @@ -448,7 +474,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret void, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestUAdd.Main(ptr %a, i32 %b) !dbg !21 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestUAdd.Main(ptr %a, i32 %b) #0 !dbg !21 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %UAdd.call = load i32, ptr %a, align 4, !dbg !22 // CHECK:STDOUT: %UAdd.call1 = add i32 %UAdd.call, %b, !dbg !22 @@ -456,7 +483,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret void, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestUSub.Main(ptr %a, i32 %b) !dbg !24 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestUSub.Main(ptr %a, i32 %b) #0 !dbg !24 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %USub.call = load i32, ptr %a, align 4, !dbg !25 // CHECK:STDOUT: %USub.call1 = sub i32 %USub.call, %b, !dbg !25 @@ -464,7 +492,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret void, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestUMul.Main(ptr %a, i32 %b) !dbg !27 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestUMul.Main(ptr %a, i32 %b) #0 !dbg !27 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %UMul.call = load i32, ptr %a, align 4, !dbg !28 // CHECK:STDOUT: %UMul.call1 = mul i32 %UMul.call, %b, !dbg !28 @@ -472,7 +501,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret void, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestUDiv.Main(ptr %a, i32 %b) !dbg !30 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestUDiv.Main(ptr %a, i32 %b) #0 !dbg !30 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %UDiv.call = load i32, ptr %a, align 4, !dbg !31 // CHECK:STDOUT: %UDiv.call1 = udiv i32 %UDiv.call, %b, !dbg !31 @@ -480,7 +510,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret void, !dbg !32 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestUMod.Main(ptr %a, i32 %b) !dbg !33 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestUMod.Main(ptr %a, i32 %b) #0 !dbg !33 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %UMod.call = load i32, ptr %a, align 4, !dbg !34 // CHECK:STDOUT: %UMod.call1 = urem i32 %UMod.call, %b, !dbg !34 @@ -488,7 +519,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret void, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestAnd.Main(ptr %a, i32 %b) !dbg !36 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestAnd.Main(ptr %a, i32 %b) #0 !dbg !36 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %And.call = load i32, ptr %a, align 4, !dbg !37 // CHECK:STDOUT: %And.call1 = and i32 %And.call, %b, !dbg !37 @@ -496,7 +528,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret void, !dbg !38 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestOr.Main(ptr %a, i32 %b) !dbg !39 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestOr.Main(ptr %a, i32 %b) #0 !dbg !39 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Or.call = load i32, ptr %a, align 4, !dbg !40 // CHECK:STDOUT: %Or.call1 = or i32 %Or.call, %b, !dbg !40 @@ -504,7 +537,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret void, !dbg !41 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestXor.Main(ptr %a, i32 %b) !dbg !42 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestXor.Main(ptr %a, i32 %b) #0 !dbg !42 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Xor.call = load i32, ptr %a, align 4, !dbg !43 // CHECK:STDOUT: %Xor.call1 = xor i32 %Xor.call, %b, !dbg !43 @@ -512,7 +546,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret void, !dbg !44 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestLeftShift.Main(ptr %a, i32 %b) !dbg !45 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestLeftShift.Main(ptr %a, i32 %b) #0 !dbg !45 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %LeftShift.call = load i32, ptr %a, align 4, !dbg !46 // CHECK:STDOUT: %LeftShift.call1 = shl i32 %LeftShift.call, %b, !dbg !46 @@ -520,7 +555,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret void, !dbg !47 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestArithmeticRightShift.Main(ptr %a, i32 %b) !dbg !48 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestArithmeticRightShift.Main(ptr %a, i32 %b) #0 !dbg !48 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ArithmeticRightShift.call = load i32, ptr %a, align 4, !dbg !49 // CHECK:STDOUT: %ArithmeticRightShift.call1 = ashr i32 %ArithmeticRightShift.call, %b, !dbg !49 @@ -528,7 +564,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret void, !dbg !50 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTestLogicalRightShift.Main(ptr %a, i32 %b) !dbg !51 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTestLogicalRightShift.Main(ptr %a, i32 %b) #0 !dbg !51 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %LogicalRightShift.call = load i32, ptr %a, align 4, !dbg !52 // CHECK:STDOUT: %LogicalRightShift.call1 = lshr i32 %LogicalRightShift.call, %b, !dbg !52 @@ -536,6 +573,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret void, !dbg !53 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -596,76 +635,88 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ; ModuleID = 'mixed_shift.carbon' // CHECK:STDOUT: source_filename = "mixed_shift.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestLeftShiftSmaller.Main(i32 %a, i16 %b) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestLeftShiftSmaller.Main(i32 %a, i16 %b) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %LeftShiftSmaller.call.rhs = zext i16 %b to i32, !dbg !7 // CHECK:STDOUT: %LeftShiftSmaller.call = shl i32 %a, %LeftShiftSmaller.call.rhs, !dbg !7 // CHECK:STDOUT: ret i32 %LeftShiftSmaller.call, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestRightShiftSmaller.Main(i32 %a, i16 %b) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestRightShiftSmaller.Main(i32 %a, i16 %b) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %RightShiftSmaller.call.rhs = zext i16 %b to i32, !dbg !10 // CHECK:STDOUT: %RightShiftSmaller.call = ashr i32 %a, %RightShiftSmaller.call.rhs, !dbg !10 // CHECK:STDOUT: ret i32 %RightShiftSmaller.call, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @_CTestLeftShiftLargerII.Main(i16 %a, i32 %b) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_CTestLeftShiftLargerII.Main(i16 %a, i32 %b) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %LeftShiftLargerII.call.rhs = trunc i32 %b to i16, !dbg !13 // CHECK:STDOUT: %LeftShiftLargerII.call = shl i16 %a, %LeftShiftLargerII.call.rhs, !dbg !13 // CHECK:STDOUT: ret i16 %LeftShiftLargerII.call, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @_CTestRightShiftLargerII.Main(i16 %a, i32 %b) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_CTestRightShiftLargerII.Main(i16 %a, i32 %b) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %RightShiftLargerII.call.rhs = trunc i32 %b to i16, !dbg !16 // CHECK:STDOUT: %RightShiftLargerII.call = ashr i16 %a, %RightShiftLargerII.call.rhs, !dbg !16 // CHECK:STDOUT: ret i16 %RightShiftLargerII.call, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @_CTestLeftShiftLargerIU.Main(i16 %a, i32 %b) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_CTestLeftShiftLargerIU.Main(i16 %a, i32 %b) #0 !dbg !18 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %LeftShiftLargerIU.call.rhs = trunc i32 %b to i16, !dbg !19 // CHECK:STDOUT: %LeftShiftLargerIU.call = shl i16 %a, %LeftShiftLargerIU.call.rhs, !dbg !19 // CHECK:STDOUT: ret i16 %LeftShiftLargerIU.call, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @_CTestRightShiftLargerIU.Main(i16 %a, i32 %b) !dbg !21 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_CTestRightShiftLargerIU.Main(i16 %a, i32 %b) #0 !dbg !21 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %RightShiftLargerIU.call.rhs = trunc i32 %b to i16, !dbg !22 // CHECK:STDOUT: %RightShiftLargerIU.call = ashr i16 %a, %RightShiftLargerIU.call.rhs, !dbg !22 // CHECK:STDOUT: ret i16 %RightShiftLargerIU.call, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @_CTestLeftShiftLargerUI.Main(i16 %a, i32 %b) !dbg !24 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_CTestLeftShiftLargerUI.Main(i16 %a, i32 %b) #0 !dbg !24 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %LeftShiftLargerUI.call.rhs = trunc i32 %b to i16, !dbg !25 // CHECK:STDOUT: %LeftShiftLargerUI.call = shl i16 %a, %LeftShiftLargerUI.call.rhs, !dbg !25 // CHECK:STDOUT: ret i16 %LeftShiftLargerUI.call, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @_CTestRightShiftLargerUI.Main(i16 %a, i32 %b) !dbg !27 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_CTestRightShiftLargerUI.Main(i16 %a, i32 %b) #0 !dbg !27 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %RightShiftLargerUI.call.rhs = trunc i32 %b to i16, !dbg !28 // CHECK:STDOUT: %RightShiftLargerUI.call = lshr i16 %a, %RightShiftLargerUI.call.rhs, !dbg !28 // CHECK:STDOUT: ret i16 %RightShiftLargerUI.call, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @_CTestLeftShiftLargerUU.Main(i16 %a, i32 %b) !dbg !30 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_CTestLeftShiftLargerUU.Main(i16 %a, i32 %b) #0 !dbg !30 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %LeftShiftLargerUU.call.rhs = trunc i32 %b to i16, !dbg !31 // CHECK:STDOUT: %LeftShiftLargerUU.call = shl i16 %a, %LeftShiftLargerUU.call.rhs, !dbg !31 // CHECK:STDOUT: ret i16 %LeftShiftLargerUU.call, !dbg !32 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @_CTestRightShiftLargerUU.Main(i16 %a, i32 %b) !dbg !33 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_CTestRightShiftLargerUU.Main(i16 %a, i32 %b) #0 !dbg !33 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %RightShiftLargerUU.call.rhs = trunc i32 %b to i16, !dbg !34 // CHECK:STDOUT: %RightShiftLargerUU.call = lshr i16 %a, %RightShiftLargerUU.call.rhs, !dbg !34 // CHECK:STDOUT: ret i16 %RightShiftLargerUU.call, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -708,14 +759,16 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ; ModuleID = 'mixed_compare.carbon' // CHECK:STDOUT: source_filename = "mixed_compare.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestEq_u16_u32.Main(i16 %a, i32 %b) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestEq_u16_u32.Main(i16 %a, i32 %b) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Eq_u16_u32.call.lhs = zext i16 %a to i32, !dbg !7 // CHECK:STDOUT: %Eq_u16_u32.call = icmp eq i32 %Eq_u16_u32.call.lhs, %b, !dbg !7 // CHECK:STDOUT: ret i1 %Eq_u16_u32.call, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestEq_i16_u32.Main(i16 %a, i32 %b) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestEq_i16_u32.Main(i16 %a, i32 %b) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Eq_i16_u32.call.lhs = sext i16 %a to i33, !dbg !10 // CHECK:STDOUT: %Eq_i16_u32.call.rhs = zext i32 %b to i33, !dbg !10 @@ -723,21 +776,24 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret i1 %Eq_i16_u32.call, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestEq_u16_i32.Main(i16 %a, i32 %b) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestEq_u16_i32.Main(i16 %a, i32 %b) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Eq_u16_i32.call.lhs = zext i16 %a to i32, !dbg !13 // CHECK:STDOUT: %Eq_u16_i32.call = icmp eq i32 %Eq_u16_i32.call.lhs, %b, !dbg !13 // CHECK:STDOUT: ret i1 %Eq_u16_i32.call, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestEq_i16_i32.Main(i16 %a, i32 %b) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestEq_i16_i32.Main(i16 %a, i32 %b) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Eq_i16_i32.call.lhs = sext i16 %a to i32, !dbg !16 // CHECK:STDOUT: %Eq_i16_i32.call = icmp eq i32 %Eq_i16_i32.call.lhs, %b, !dbg !16 // CHECK:STDOUT: ret i1 %Eq_i16_i32.call, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestEq_i32_u32.Main(i32 %a, i32 %b) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestEq_i32_u32.Main(i32 %a, i32 %b) #0 !dbg !18 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Eq_i32_u32.call.lhs = sext i32 %a to i33, !dbg !19 // CHECK:STDOUT: %Eq_i32_u32.call.rhs = zext i32 %b to i33, !dbg !19 @@ -745,14 +801,16 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret i1 %Eq_i32_u32.call, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestLess_u16_u32.Main(i16 %a, i32 %b) !dbg !21 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestLess_u16_u32.Main(i16 %a, i32 %b) #0 !dbg !21 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Less_u16_u32.call.lhs = zext i16 %a to i32, !dbg !22 // CHECK:STDOUT: %Less_u16_u32.call = icmp ult i32 %Less_u16_u32.call.lhs, %b, !dbg !22 // CHECK:STDOUT: ret i1 %Less_u16_u32.call, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestLess_i16_u32.Main(i16 %a, i32 %b) !dbg !24 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestLess_i16_u32.Main(i16 %a, i32 %b) #0 !dbg !24 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Less_i16_u32.call.lhs = sext i16 %a to i33, !dbg !25 // CHECK:STDOUT: %Less_i16_u32.call.rhs = zext i32 %b to i33, !dbg !25 @@ -760,21 +818,24 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret i1 %Less_i16_u32.call, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestLess_u16_i32.Main(i16 %a, i32 %b) !dbg !27 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestLess_u16_i32.Main(i16 %a, i32 %b) #0 !dbg !27 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Less_u16_i32.call.lhs = zext i16 %a to i32, !dbg !28 // CHECK:STDOUT: %Less_u16_i32.call = icmp slt i32 %Less_u16_i32.call.lhs, %b, !dbg !28 // CHECK:STDOUT: ret i1 %Less_u16_i32.call, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestLess_i16_i32.Main(i16 %a, i32 %b) !dbg !30 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestLess_i16_i32.Main(i16 %a, i32 %b) #0 !dbg !30 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Less_i16_i32.call.lhs = sext i16 %a to i32, !dbg !31 // CHECK:STDOUT: %Less_i16_i32.call = icmp slt i32 %Less_i16_i32.call.lhs, %b, !dbg !31 // CHECK:STDOUT: ret i1 %Less_i16_i32.call, !dbg !32 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestLess_i32_u32.Main(i32 %a, i32 %b) !dbg !33 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestLess_i32_u32.Main(i32 %a, i32 %b) #0 !dbg !33 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Less_i32_u32.call.lhs = sext i32 %a to i33, !dbg !34 // CHECK:STDOUT: %Less_i32_u32.call.rhs = zext i32 %b to i33, !dbg !34 @@ -782,6 +843,8 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ret i1 %Less_i32_u32.call, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -824,74 +887,88 @@ fn TestUint32ToUint64(a: u32) -> u64 { return Uint32ToUint64(a); } // CHECK:STDOUT: ; ModuleID = 'convert.carbon' // CHECK:STDOUT: source_filename = "convert.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestInt32ToInt32.Main(i32 %a) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestInt32ToInt32.Main(i32 %a) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 %a, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestInt32ToUint32.Main(i32 %a) !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestInt32ToUint32.Main(i32 %a) #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 %a, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestUint32ToInt32.Main(i32 %a) !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestUint32ToInt32.Main(i32 %a) #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 %a, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestUint32ToUint32.Main(i32 %a) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestUint32ToUint32.Main(i32 %a) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 %a, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @_CTestInt32ToInt16.Main(i32 %a) !dbg !14 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_CTestInt32ToInt16.Main(i32 %a) #0 !dbg !14 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int32ToInt16.call = trunc i32 %a to i16, !dbg !15 // CHECK:STDOUT: ret i16 %Int32ToInt16.call, !dbg !16 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @_CTestInt32ToUint16.Main(i32 %a) !dbg !17 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_CTestInt32ToUint16.Main(i32 %a) #0 !dbg !17 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int32ToUint16.call = trunc i32 %a to i16, !dbg !18 // CHECK:STDOUT: ret i16 %Int32ToUint16.call, !dbg !19 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @_CTestUint32ToInt16.Main(i32 %a) !dbg !20 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_CTestUint32ToInt16.Main(i32 %a) #0 !dbg !20 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Uint32ToInt16.call = trunc i32 %a to i16, !dbg !21 // CHECK:STDOUT: ret i16 %Uint32ToInt16.call, !dbg !22 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @_CTestUint32ToUint16.Main(i32 %a) !dbg !23 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_CTestUint32ToUint16.Main(i32 %a) #0 !dbg !23 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Uint32ToUint16.call = trunc i32 %a to i16, !dbg !24 // CHECK:STDOUT: ret i16 %Uint32ToUint16.call, !dbg !25 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CTestInt32ToInt64.Main(i32 %a) !dbg !26 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CTestInt32ToInt64.Main(i32 %a) #0 !dbg !26 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int32ToInt64.call = sext i32 %a to i64, !dbg !27 // CHECK:STDOUT: ret i64 %Int32ToInt64.call, !dbg !28 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CTestInt32ToUint64.Main(i32 %a) !dbg !29 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CTestInt32ToUint64.Main(i32 %a) #0 !dbg !29 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int32ToUint64.call = sext i32 %a to i64, !dbg !30 // CHECK:STDOUT: ret i64 %Int32ToUint64.call, !dbg !31 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CTestUint32ToInt64.Main(i32 %a) !dbg !32 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CTestUint32ToInt64.Main(i32 %a) #0 !dbg !32 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Uint32ToInt64.call = zext i32 %a to i64, !dbg !33 // CHECK:STDOUT: ret i64 %Uint32ToInt64.call, !dbg !34 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CTestUint32ToUint64.Main(i32 %a) !dbg !35 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CTestUint32ToUint64.Main(i32 %a) #0 !dbg !35 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Uint32ToUint64.call = zext i32 %a to i64, !dbg !36 // CHECK:STDOUT: ret i64 %Uint32ToUint64.call, !dbg !37 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/builtins/int_literal.carbon b/toolchain/lower/testdata/builtins/int_literal.carbon index b8c3bf26dbfe6..52efe18de0e9f 100644 --- a/toolchain/lower/testdata/builtins/int_literal.carbon +++ b/toolchain/lower/testdata/builtins/int_literal.carbon @@ -31,26 +31,32 @@ fn IntMin() -> i32 { // CHECK:STDOUT: ; ModuleID = 'int_literal.carbon' // CHECK:STDOUT: source_filename = "int_literal.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define {} @_CCopy.Main({} %x) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define {} @_CCopy.Main({} %x) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret {} %x, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CMinusOne.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CMinusOne.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 -1, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CIntMax.Main() !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CIntMax.Main() #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 2147483647, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CIntMin.Main() !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CIntMin.Main() #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 -2147483648, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/builtins/maybe_unformed.carbon b/toolchain/lower/testdata/builtins/maybe_unformed.carbon index feae4ea6b37de..fb480f6827dce 100644 --- a/toolchain/lower/testdata/builtins/maybe_unformed.carbon +++ b/toolchain/lower/testdata/builtins/maybe_unformed.carbon @@ -37,14 +37,16 @@ fn PassAdapter() { // CHECK:STDOUT: ; ModuleID = 'maybe_unformed.carbon' // CHECK:STDOUT: source_filename = "maybe_unformed.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTakeBuiltin.Main(ptr %x) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTakeBuiltin.Main(ptr %x) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CMakeBuiltin.Main(ptr sret(i32)) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CPassBuiltin.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CPassBuiltin.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc21_27.1.temp = alloca i32, align 4, !dbg !9 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc21_27.1.temp), !dbg !9 @@ -53,14 +55,16 @@ fn PassAdapter() { // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTakeAdapter.Main(ptr %x) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTakeAdapter.Main(ptr %x) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CMakeAdapter.Main(ptr sret(i32)) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CPassAdapter.Main() !dbg !14 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CPassAdapter.Main() #0 !dbg !14 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc34_27.1.temp = alloca i32, align 4, !dbg !15 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc34_27.1.temp), !dbg !15 @@ -70,12 +74,13 @@ fn PassAdapter() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon b/toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon index 98a3faa27502f..2209468210c4e 100644 --- a/toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon +++ b/toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon @@ -19,18 +19,22 @@ fn TestAddMethod(a: i32, b: i32) -> i32 { return a.(AddMethod)(b); } // CHECK:STDOUT: ; ModuleID = 'method_vs_nonmethod.carbon' // CHECK:STDOUT: source_filename = "method_vs_nonmethod.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestAddNonmethod.Main(i32 %a, i32 %b) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestAddNonmethod.Main(i32 %a, i32 %b) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %AddNonmethod.call = add i32 %a, %b, !dbg !7 // CHECK:STDOUT: ret i32 %AddNonmethod.call, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTestAddMethod.Main(i32 %a, i32 %b) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTestAddMethod.Main(i32 %a, i32 %b) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %AddMethod.call = add i32 %a, %b, !dbg !10 // CHECK:STDOUT: ret i32 %AddMethod.call, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/builtins/no_op.carbon b/toolchain/lower/testdata/builtins/no_op.carbon index 99907f0430f31..c093bda77ffdc 100644 --- a/toolchain/lower/testdata/builtins/no_op.carbon +++ b/toolchain/lower/testdata/builtins/no_op.carbon @@ -36,26 +36,30 @@ fn J() { // CHECK:STDOUT: ; ModuleID = 'no_op.carbon' // CHECK:STDOUT: source_filename = "no_op.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CG.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CG.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca {}, align 8, !dbg !9 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %a.var), !dbg !9 // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CH.Main() !dbg !11 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CH.Main() #0 !dbg !11 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CI.Main() // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CJ.Main() !dbg !13 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CJ.Main() #0 !dbg !13 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc33_11.1.temp = alloca {}, align 8, !dbg !14 // CHECK:STDOUT: call void @_CI.Main(), !dbg !14 @@ -64,12 +68,13 @@ fn J() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/builtins/overloaded_operator.carbon b/toolchain/lower/testdata/builtins/overloaded_operator.carbon index 67906f720989f..565e20a5b5004 100644 --- a/toolchain/lower/testdata/builtins/overloaded_operator.carbon +++ b/toolchain/lower/testdata/builtins/overloaded_operator.carbon @@ -17,13 +17,16 @@ fn AddThreeIntegers(a: i32, b: i32, c: i32) -> i32 { // CHECK:STDOUT: ; ModuleID = 'overloaded_operator.carbon' // CHECK:STDOUT: source_filename = "overloaded_operator.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CAddThreeIntegers.Main(i32 %a, i32 %b, i32 %c) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CAddThreeIntegers.Main(i32 %a, i32 %b, i32 %c) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.AddWith.impl.Op.call.loc14_12 = add i32 %a, %b, !dbg !7 // CHECK:STDOUT: %Int.as.AddWith.impl.Op.call.loc14_16 = add i32 %Int.as.AddWith.impl.Op.call.loc14_12, %c, !dbg !7 // CHECK:STDOUT: ret i32 %Int.as.AddWith.impl.Op.call.loc14_16, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/builtins/pointer.carbon b/toolchain/lower/testdata/builtins/pointer.carbon index 3f675250e4845..dc86e56eafe4c 100644 --- a/toolchain/lower/testdata/builtins/pointer.carbon +++ b/toolchain/lower/testdata/builtins/pointer.carbon @@ -27,19 +27,23 @@ fn Check(p: MakeUnformed(C*)) -> bool { // CHECK:STDOUT: ; ModuleID = 'pointer.carbon' // CHECK:STDOUT: source_filename = "pointer.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CNull.Main(ptr sret(ptr) %return) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CNull.Main(ptr sret(ptr) %return) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: store ptr null, ptr %return, align 8, !dbg !7 // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CCheck.Main(ptr %p) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CCheck.Main(ptr %p) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %IsNull.call = load ptr, ptr %p, align 8, !dbg !10 // CHECK:STDOUT: %IsNull.call1 = icmp eq ptr %IsNull.call, null, !dbg !10 // CHECK:STDOUT: ret i1 %IsNull.call1, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/builtins/print_read.carbon b/toolchain/lower/testdata/builtins/print_read.carbon index f0b632e2c8e97..549a7b01e8d38 100644 --- a/toolchain/lower/testdata/builtins/print_read.carbon +++ b/toolchain/lower/testdata/builtins/print_read.carbon @@ -32,7 +32,8 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: @printf.int.format = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Print.call = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 1), !dbg !7 // CHECK:STDOUT: br label %while.cond, !dbg !8 @@ -67,6 +68,8 @@ fn Main() { // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @putchar, { 1, 0 } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/builtins/type.carbon b/toolchain/lower/testdata/builtins/type.carbon index d90985895ce6e..20cf678240a5b 100644 --- a/toolchain/lower/testdata/builtins/type.carbon +++ b/toolchain/lower/testdata/builtins/type.carbon @@ -41,11 +41,14 @@ fn F() { // CHECK:STDOUT: ; ModuleID = 'can_destroy.carbon' // CHECK:STDOUT: source_filename = "can_destroy.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -63,11 +66,14 @@ fn F() { // CHECK:STDOUT: @_Ca.Main = global {} zeroinitializer // CHECK:STDOUT: @_Cb.Main = global {} zeroinitializer // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/builtins/types.carbon b/toolchain/lower/testdata/builtins/types.carbon index 4b1df0bc34131..47d39cef588e8 100644 --- a/toolchain/lower/testdata/builtins/types.carbon +++ b/toolchain/lower/testdata/builtins/types.carbon @@ -40,7 +40,8 @@ fn Uses() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CBoolParam.Main(i1) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CUses.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CUses.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CIntParam.Main(i32 1), !dbg !7 // CHECK:STDOUT: call void @_CFloatParam.Main(half 0xH3C00, float 1.000000e+00, double 1.000000e+00, fp128 0xL00000000000000003FFF000000000000), !dbg !8 @@ -48,6 +49,8 @@ fn Uses() { // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/builtins/uint.carbon b/toolchain/lower/testdata/builtins/uint.carbon index 8f6b020d333cd..b9b2ff2fffad4 100644 --- a/toolchain/lower/testdata/builtins/uint.carbon +++ b/toolchain/lower/testdata/builtins/uint.carbon @@ -67,114 +67,134 @@ fn TestGreaterEq(a: u64, b: u64) -> bool { return GreaterEq(a, b); } // CHECK:STDOUT: ; ModuleID = 'uint.carbon' // CHECK:STDOUT: source_filename = "uint.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CTestNegate.Main(i64 %a) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CTestNegate.Main(i64 %a) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Negate.call = sub i64 0, %a, !dbg !7 // CHECK:STDOUT: ret i64 %Negate.call, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CTestAdd.Main(i64 %a, i64 %b) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CTestAdd.Main(i64 %a, i64 %b) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Add.call = add i64 %a, %b, !dbg !10 // CHECK:STDOUT: ret i64 %Add.call, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CTestSub.Main(i64 %a, i64 %b) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CTestSub.Main(i64 %a, i64 %b) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Sub.call = sub i64 %a, %b, !dbg !13 // CHECK:STDOUT: ret i64 %Sub.call, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CTestMul.Main(i64 %a, i64 %b) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CTestMul.Main(i64 %a, i64 %b) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Mul.call = mul i64 %a, %b, !dbg !16 // CHECK:STDOUT: ret i64 %Mul.call, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CTestDiv.Main(i64 %a, i64 %b) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CTestDiv.Main(i64 %a, i64 %b) #0 !dbg !18 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Div.call = udiv i64 %a, %b, !dbg !19 // CHECK:STDOUT: ret i64 %Div.call, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CTestMod.Main(i64 %a, i64 %b) !dbg !21 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CTestMod.Main(i64 %a, i64 %b) #0 !dbg !21 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Mod.call = urem i64 %a, %b, !dbg !22 // CHECK:STDOUT: ret i64 %Mod.call, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CTestComplement.Main(i64 %a) !dbg !24 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CTestComplement.Main(i64 %a) #0 !dbg !24 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Complement.call = xor i64 -1, %a, !dbg !25 // CHECK:STDOUT: ret i64 %Complement.call, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CTestAnd.Main(i64 %a, i64 %b) !dbg !27 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CTestAnd.Main(i64 %a, i64 %b) #0 !dbg !27 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %And.call = and i64 %a, %b, !dbg !28 // CHECK:STDOUT: ret i64 %And.call, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CTestOr.Main(i64 %a, i64 %b) !dbg !30 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CTestOr.Main(i64 %a, i64 %b) #0 !dbg !30 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Or.call = or i64 %a, %b, !dbg !31 // CHECK:STDOUT: ret i64 %Or.call, !dbg !32 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CTestXor.Main(i64 %a, i64 %b) !dbg !33 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CTestXor.Main(i64 %a, i64 %b) #0 !dbg !33 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Xor.call = xor i64 %a, %b, !dbg !34 // CHECK:STDOUT: ret i64 %Xor.call, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CTestLeftShift.Main(i64 %a, i64 %b) !dbg !36 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CTestLeftShift.Main(i64 %a, i64 %b) #0 !dbg !36 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %LeftShift.call = shl i64 %a, %b, !dbg !37 // CHECK:STDOUT: ret i64 %LeftShift.call, !dbg !38 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CTestRightShift.Main(i64 %a, i64 %b) !dbg !39 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CTestRightShift.Main(i64 %a, i64 %b) #0 !dbg !39 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %RightShift.call = lshr i64 %a, %b, !dbg !40 // CHECK:STDOUT: ret i64 %RightShift.call, !dbg !41 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestEq.Main(i64 %a, i64 %b) !dbg !42 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestEq.Main(i64 %a, i64 %b) #0 !dbg !42 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Eq.call = icmp eq i64 %a, %b, !dbg !43 // CHECK:STDOUT: ret i1 %Eq.call, !dbg !44 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestNeq.Main(i64 %a, i64 %b) !dbg !45 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestNeq.Main(i64 %a, i64 %b) #0 !dbg !45 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Neq.call = icmp ne i64 %a, %b, !dbg !46 // CHECK:STDOUT: ret i1 %Neq.call, !dbg !47 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestLess.Main(i64 %a, i64 %b) !dbg !48 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestLess.Main(i64 %a, i64 %b) #0 !dbg !48 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Less.call = icmp ult i64 %a, %b, !dbg !49 // CHECK:STDOUT: ret i1 %Less.call, !dbg !50 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestLessEq.Main(i64 %a, i64 %b) !dbg !51 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestLessEq.Main(i64 %a, i64 %b) #0 !dbg !51 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %LessEq.call = icmp ule i64 %a, %b, !dbg !52 // CHECK:STDOUT: ret i1 %LessEq.call, !dbg !53 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestGreater.Main(i64 %a, i64 %b) !dbg !54 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestGreater.Main(i64 %a, i64 %b) #0 !dbg !54 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Greater.call = icmp ugt i64 %a, %b, !dbg !55 // CHECK:STDOUT: ret i1 %Greater.call, !dbg !56 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CTestGreaterEq.Main(i64 %a, i64 %b) !dbg !57 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CTestGreaterEq.Main(i64 %a, i64 %b) #0 !dbg !57 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %GreaterEq.call = icmp uge i64 %a, %b, !dbg !58 // CHECK:STDOUT: ret i1 %GreaterEq.call, !dbg !59 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/class/adapt.carbon b/toolchain/lower/testdata/class/adapt.carbon index 3e450af9b8475..2ff083c016036 100644 --- a/toolchain/lower/testdata/class/adapt.carbon +++ b/toolchain/lower/testdata/class/adapt.carbon @@ -62,7 +62,8 @@ fn DoStuff(a: Int) -> Int { // CHECK:STDOUT: // CHECK:STDOUT: @PairOfInts.val.loc9_28 = internal constant { i32, i32 } { i32 1, i32 2 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMake.PairOfInts.Main(ptr sret({ i32, i32 }) %return) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMake.PairOfInts.Main(ptr sret({ i32, i32 }) %return) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc9_27.3.a = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %.loc9_27.6.b = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7 @@ -70,20 +71,23 @@ fn DoStuff(a: Int) -> Int { // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMake.PairAdapter.Main(ptr sret({ i32, i32 }) %return) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMake.PairAdapter.Main(ptr sret({ i32, i32 }) %return) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CMake.PairOfInts.Main(ptr %return), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CGetB.PairAdapter.Main(ptr %self) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CGetB.PairAdapter.Main(ptr %self) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc22_14.1.b = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 1, !dbg !13 // CHECK:STDOUT: %.loc22_14.2 = load i32, ptr %.loc22_14.1.b, align 4, !dbg !13 // CHECK:STDOUT: ret i32 %.loc22_14.2, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CUse.Main() !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CUse.Main() #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %pa.var = alloca { i32, i32 }, align 8, !dbg !16 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %pa.var), !dbg !16 @@ -93,13 +97,14 @@ fn DoStuff(a: Int) -> Int { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -127,17 +132,21 @@ fn DoStuff(a: Int) -> Int { // CHECK:STDOUT: ; ModuleID = 'adapt_int.carbon' // CHECK:STDOUT: source_filename = "adapt_int.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @"_COp.Int.Main:Copy.Core"(i32 %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @"_COp.Int.Main:Copy.Core"(i32 %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 %self, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CDoStuff.Main(i32 %a) !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CDoStuff.Main(i32 %a) #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.Copy.impl.Op.call = call i32 @"_COp.Int.Main:Copy.Core"(i32 %a), !dbg !9 // CHECK:STDOUT: ret i32 %Int.as.Copy.impl.Op.call, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/class/base.carbon b/toolchain/lower/testdata/class/base.carbon index 995243be2ee08..c3ba2229eaff5 100644 --- a/toolchain/lower/testdata/class/base.carbon +++ b/toolchain/lower/testdata/class/base.carbon @@ -37,7 +37,8 @@ fn Convert(p: Derived*) -> Base* { // CHECK:STDOUT: // CHECK:STDOUT: @Derived.val.loc24_36 = internal constant { { i32 }, i32 } { { i32 } { i32 4 }, i32 7 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMake.Main(ptr sret({ { i32 }, i32 }) %return) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMake.Main(ptr sret({ { i32 }, i32 }) %return) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc24_35.2.base = getelementptr inbounds nuw { { i32 }, i32 }, ptr %return, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %.loc24_26.3.b = getelementptr inbounds nuw { i32 }, ptr %.loc24_35.2.base, i32 0, i32 0, !dbg !8 @@ -46,7 +47,8 @@ fn Convert(p: Derived*) -> Base* { // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CAccess.Main(ptr sret({ i32, i32 }) %return, ptr %d) !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CAccess.Main(ptr sret({ i32, i32 }) %return, ptr %d) #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc28_12.1.d = getelementptr inbounds nuw { { i32 }, i32 }, ptr %d, i32 0, i32 1, !dbg !11 // CHECK:STDOUT: %.loc28_12.2 = load i32, ptr %.loc28_12.1.d, align 4, !dbg !11 @@ -60,16 +62,18 @@ fn Convert(p: Derived*) -> Base* { // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define ptr @_CConvert.Main(ptr %p) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define ptr @_CConvert.Main(ptr %p) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc32_11.2.base = getelementptr inbounds nuw { { i32 }, i32 }, ptr %p, i32 0, i32 0, !dbg !16 // CHECK:STDOUT: ret ptr %.loc32_11.2.base, !dbg !16 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/class/basic.carbon b/toolchain/lower/testdata/class/basic.carbon index 76719d12b08ea..fd5c5e2820fa6 100644 --- a/toolchain/lower/testdata/class/basic.carbon +++ b/toolchain/lower/testdata/class/basic.carbon @@ -27,7 +27,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CF.Main(ptr sret({ i32, ptr }), ptr) // CHECK:STDOUT: -// CHECK:STDOUT: define void @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c.var = alloca { i32, ptr }, align 8, !dbg !7 // CHECK:STDOUT: %d.var = alloca { i32, ptr }, align 8, !dbg !8 @@ -38,12 +39,13 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/class/convert.carbon b/toolchain/lower/testdata/class/convert.carbon index 7ae126b569b17..e88887d339348 100644 --- a/toolchain/lower/testdata/class/convert.carbon +++ b/toolchain/lower/testdata/class/convert.carbon @@ -30,19 +30,22 @@ fn DoIt() { // CHECK:STDOUT: // CHECK:STDOUT: @IntWrapper.val.loc24_3 = internal constant { i32 } { i32 42 } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @"_CConvert.IntWrapper.Main:ImplicitAs.Core"(ptr %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @"_CConvert.IntWrapper.Main:ImplicitAs.Core"(ptr %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc18_48.1.n = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %.loc18_48.2 = load i32, ptr %.loc18_48.1.n, align 4, !dbg !7 // CHECK:STDOUT: ret i32 %.loc18_48.2, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CConsume.Main(i32 %n) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CConsume.Main(i32 %n) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CDoIt.Main() !dbg !11 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CDoIt.Main() #0 !dbg !11 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %w.var = alloca { i32 }, align 8, !dbg !12 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %w.var), !dbg !12 @@ -54,13 +57,14 @@ fn DoIt() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/class/field.carbon b/toolchain/lower/testdata/class/field.carbon index 8bd797ce38c59..f8ffa3a021c97 100644 --- a/toolchain/lower/testdata/class/field.carbon +++ b/toolchain/lower/testdata/class/field.carbon @@ -71,7 +71,8 @@ fn Run() { // CHECK:STDOUT: ; ModuleID = 'basic.carbon' // CHECK:STDOUT: source_filename = "basic.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CF.Main(ptr %c) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CF.Main(ptr %c) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc10_13.1.b = getelementptr inbounds nuw { i32, ptr }, ptr %c, i32 0, i32 1, !dbg !7 // CHECK:STDOUT: %.loc10_13.2 = load ptr, ptr %.loc10_13.1.b, align 8, !dbg !7 @@ -80,7 +81,8 @@ fn Run() { // CHECK:STDOUT: ret i32 %.loc10_16.2, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @main() !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @main() #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c.var = alloca { i32, ptr }, align 8, !dbg !11 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !11 @@ -93,9 +95,10 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -121,7 +124,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: @Other.val.loc15_33.5 = internal constant {} zeroinitializer // CHECK:STDOUT: -// CHECK:STDOUT: define void @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %o.var = alloca {}, align 8, !dbg !7 // CHECK:STDOUT: %u.var = alloca { ptr, {} }, align 8, !dbg !8 @@ -135,16 +139,17 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -165,7 +170,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: @Other.val.loc17_40.5 = internal constant { i32 } { i32 42 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %o.var = alloca { i32 }, align 8, !dbg !7 // CHECK:STDOUT: %u.var = alloca { ptr, { i32 } }, align 8, !dbg !8 @@ -180,16 +186,17 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/class/generic.carbon b/toolchain/lower/testdata/class/generic.carbon index 115c25946fba1..fb2079c7c27df 100644 --- a/toolchain/lower/testdata/class/generic.carbon +++ b/toolchain/lower/testdata/class/generic.carbon @@ -117,7 +117,8 @@ fn AccessTuple() -> (i32, i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: @Derived.val.loc7_36 = internal constant { { i32 }, i32 } { { i32 } { i32 1 }, i32 2 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CCreateDerived.Create(ptr sret({ { i32 }, i32 }) %return) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CCreateDerived.Create(ptr sret({ { i32 }, i32 }) %return) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7_35.2.base = getelementptr inbounds nuw { { i32 }, i32 }, ptr %return, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %.loc7_26.3.b = getelementptr inbounds nuw { i32 }, ptr %.loc7_35.2.base, i32 0, i32 0, !dbg !8 @@ -126,16 +127,18 @@ fn AccessTuple() -> (i32, i32, i32) { // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CCreateAdapter.Create(ptr sret({ { i32 }, i32 }) %return) !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CCreateAdapter.Create(ptr sret({ { i32 }, i32 }) %return) #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CCreateDerived.Create(ptr %return), !dbg !11 // CHECK:STDOUT: ret void, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -158,25 +161,29 @@ fn AccessTuple() -> (i32, i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: @tuple.loc22_28.6 = internal constant { i32, i32 } { i32 1, i32 2 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CInts.Main(ptr sret({ i32, i32 }) %return) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CInts.Main(ptr sret({ i32, i32 }) %return) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CMake.Main.5450dc8e8b8e0899(ptr %return, i32 1, i32 2), !dbg !7 // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CEmpty.Main(ptr sret({ {}, {} }) %return) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CEmpty.Main(ptr sret({ {}, {} }) %return) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CMake.Main.cf13cead63317d44(ptr %return), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTuples.Main(ptr sret({ { i32, i32 }, { i32, i32 } }) %return) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTuples.Main(ptr sret({ { i32, i32 }, { i32, i32 } }) %return) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CMake.Main.a862d5c8b748242e(ptr %return, ptr @tuple.loc22_28.6, ptr @tuple.loc22_28.6), !dbg !13 // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CMake.Main.5450dc8e8b8e0899(ptr sret({ i32, i32 }) %return, i32 %x, i32 %y) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CMake.Main.5450dc8e8b8e0899(ptr sret({ i32, i32 }) %return, i32 %x, i32 %y) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc10_25.2.x = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !16 // CHECK:STDOUT: store i32 %x, ptr %.loc10_25.2.x, align 4, !dbg !16 @@ -185,14 +192,16 @@ fn AccessTuple() -> (i32, i32, i32) { // CHECK:STDOUT: ret void, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CMake.Main.cf13cead63317d44(ptr sret({ {}, {} }) %return) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CMake.Main.cf13cead63317d44(ptr sret({ {}, {} }) %return) #0 !dbg !18 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc10_25.2.x = getelementptr inbounds nuw { {}, {} }, ptr %return, i32 0, i32 0, !dbg !19 // CHECK:STDOUT: %.loc10_25.4.y = getelementptr inbounds nuw { {}, {} }, ptr %return, i32 0, i32 1, !dbg !19 // CHECK:STDOUT: ret void, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CMake.Main.a862d5c8b748242e(ptr sret({ { i32, i32 }, { i32, i32 } }) %return, ptr %x, ptr %y) !dbg !21 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CMake.Main.a862d5c8b748242e(ptr sret({ { i32, i32 }, { i32, i32 } }) %return, ptr %x, ptr %y) #0 !dbg !21 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc10_25.2.x = getelementptr inbounds nuw { { i32, i32 }, { i32, i32 } }, ptr %return, i32 0, i32 0, !dbg !22 // CHECK:STDOUT: call void @"_COp.2b3ba83e01542f11:Copy.Core.4193728889277ad1"(ptr %.loc10_25.2.x, ptr %x), !dbg !23 @@ -201,7 +210,8 @@ fn AccessTuple() -> (i32, i32, i32) { // CHECK:STDOUT: ret void, !dbg !25 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_COp.2b3ba83e01542f11:Copy.Core.4193728889277ad1"(ptr sret({ i32, i32 }) %return, ptr %self) !dbg !26 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_COp.2b3ba83e01542f11:Copy.Core.4193728889277ad1"(ptr sret({ i32, i32 }) %return, ptr %self) #0 !dbg !26 { // CHECK:STDOUT: %tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 0, !dbg !28 // CHECK:STDOUT: %tuple.elem.load = load i32, ptr %tuple.elem, align 4, !dbg !28 // CHECK:STDOUT: %tuple.elem1 = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !29 @@ -216,6 +226,8 @@ fn AccessTuple() -> (i32, i32, i32) { // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @"_COp.2b3ba83e01542f11:Copy.Core.4193728889277ad1", { 1, 0 } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -258,7 +270,8 @@ fn AccessTuple() -> (i32, i32, i32) { // CHECK:STDOUT: @C.val.f52.loc26_3 = internal constant { i1, {} } { i1 true, {} zeroinitializer } // CHECK:STDOUT: @C.val.029.loc31_3 = internal constant { i1, { i32, i32, i32 } } { i1 true, { i32, i32, i32 } { i32 1, i32 2, i32 3 } } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CAccessBool.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CAccessBool.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c.var = alloca { i1, i32 }, align 8, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !7 @@ -269,7 +282,8 @@ fn AccessTuple() -> (i32, i32, i32) { // CHECK:STDOUT: ret i1 %C.GetBool.call, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CAccessInt.Main() !dbg !11 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CAccessInt.Main() #0 !dbg !11 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c.var = alloca { i1, i32 }, align 8, !dbg !12 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !12 @@ -280,7 +294,8 @@ fn AccessTuple() -> (i32, i32, i32) { // CHECK:STDOUT: ret i32 %C.GetT.call, !dbg !15 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CAccessEmpty.Main() !dbg !16 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CAccessEmpty.Main() #0 !dbg !16 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c.var = alloca { i1, {} }, align 8, !dbg !17 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !17 @@ -291,7 +306,8 @@ fn AccessTuple() -> (i32, i32, i32) { // CHECK:STDOUT: ret void, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CAccessTuple.Main(ptr sret({ i32, i32, i32 }) %return) !dbg !21 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CAccessTuple.Main(ptr sret({ i32, i32, i32 }) %return) #0 !dbg !21 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c.var = alloca { i1, { i32, i32, i32 } }, align 8, !dbg !22 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !22 @@ -306,12 +322,13 @@ fn AccessTuple() -> (i32, i32, i32) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i1 @_CGetBool.C.Main.5450dc8e8b8e0899(ptr %self) !dbg !27 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i1 @_CGetBool.C.Main.5450dc8e8b8e0899(ptr %self) #0 !dbg !27 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc6_16.1.v = getelementptr inbounds nuw { i1, i32 }, ptr %self, i32 0, i32 0, !dbg !28 // CHECK:STDOUT: %.loc6_16.2 = load i8, ptr %.loc6_16.1.v, align 1, !dbg !28 @@ -319,27 +336,31 @@ fn AccessTuple() -> (i32, i32, i32) { // CHECK:STDOUT: ret i1 %.loc6_16.21, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CGetT.C.Main.5450dc8e8b8e0899(ptr %self) !dbg !30 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CGetT.C.Main.5450dc8e8b8e0899(ptr %self) #0 !dbg !30 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc9_16.1.w = getelementptr inbounds nuw { i1, i32 }, ptr %self, i32 0, i32 1, !dbg !31 // CHECK:STDOUT: %.loc9_16.2 = load i32, ptr %.loc9_16.1.w, align 4, !dbg !31 // CHECK:STDOUT: ret i32 %.loc9_16.2, !dbg !32 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CGetT.C.Main.cf13cead63317d44(ptr %self) !dbg !33 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CGetT.C.Main.cf13cead63317d44(ptr %self) #0 !dbg !33 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc9_16.1.w = getelementptr inbounds nuw { i1, {} }, ptr %self, i32 0, i32 1, !dbg !34 // CHECK:STDOUT: ret void, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CGetT.C.Main.623a49e5eda7ec3b(ptr sret({ i32, i32, i32 }) %return, ptr %self) !dbg !36 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CGetT.C.Main.623a49e5eda7ec3b(ptr sret({ i32, i32, i32 }) %return, ptr %self) #0 !dbg !36 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc9_16.1.w = getelementptr inbounds nuw { i1, { i32, i32, i32 } }, ptr %self, i32 0, i32 1, !dbg !37 // CHECK:STDOUT: call void @"_COp.6d582b60b7397ec5:Copy.Core.8e95c89adba3b450"(ptr %return, ptr %.loc9_16.1.w), !dbg !37 // CHECK:STDOUT: ret void, !dbg !38 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_COp.6d582b60b7397ec5:Copy.Core.8e95c89adba3b450"(ptr sret({ i32, i32, i32 }) %return, ptr %self) !dbg !39 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_COp.6d582b60b7397ec5:Copy.Core.8e95c89adba3b450"(ptr sret({ i32, i32, i32 }) %return, ptr %self) #0 !dbg !39 { // CHECK:STDOUT: %tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %self, i32 0, i32 0, !dbg !41 // CHECK:STDOUT: %tuple.elem.load = load i32, ptr %tuple.elem, align 4, !dbg !41 // CHECK:STDOUT: %tuple.elem1 = getelementptr inbounds nuw { i32, i32, i32 }, ptr %return, i32 0, i32 0, !dbg !42 @@ -359,8 +380,9 @@ fn AccessTuple() -> (i32, i32, i32) { // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 3, 2, 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/class/import.carbon b/toolchain/lower/testdata/class/import.carbon index 82e89f3b9ce97..069ccb3ddcf2a 100644 --- a/toolchain/lower/testdata/class/import.carbon +++ b/toolchain/lower/testdata/class/import.carbon @@ -42,7 +42,8 @@ fn Run() { // CHECK:STDOUT: ; ModuleID = 'b.carbon' // CHECK:STDOUT: source_filename = "b.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CF.C.Main(), !dbg !7 // CHECK:STDOUT: ret void, !dbg !8 @@ -50,6 +51,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CF.C.Main() // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/class/method.carbon b/toolchain/lower/testdata/class/method.carbon index c64a703445aa7..aaecb6dbf7438 100644 --- a/toolchain/lower/testdata/class/method.carbon +++ b/toolchain/lower/testdata/class/method.carbon @@ -29,13 +29,16 @@ fn F(p: C*) { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CSet.C.Main(ptr, i32) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main(ptr %p) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main(ptr %p) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %C.Get.call = call i32 @_CGet.C.Main(ptr %p), !dbg !7 // CHECK:STDOUT: call void @_CSet.C.Main(ptr %p, i32 %C.Get.call), !dbg !8 // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/class/method_addr.carbon b/toolchain/lower/testdata/class/method_addr.carbon index d9a6e1554a914..78f0b16bc5806 100644 --- a/toolchain/lower/testdata/class/method_addr.carbon +++ b/toolchain/lower/testdata/class/method_addr.carbon @@ -29,13 +29,16 @@ fn F(p: C*) { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CSet.C.Main(ptr, i32) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main(ptr %p) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main(ptr %p) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %C.Get.call = call i32 @_CGet.C.Main(ptr %p), !dbg !7 // CHECK:STDOUT: call void @_CSet.C.Main(ptr %p, i32 %C.Get.call), !dbg !8 // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/class/self.carbon b/toolchain/lower/testdata/class/self.carbon index 5e652f63e61bb..906a2eb149063 100644 --- a/toolchain/lower/testdata/class/self.carbon +++ b/toolchain/lower/testdata/class/self.carbon @@ -28,20 +28,24 @@ fn C.Set[ref self: C]() { // CHECK:STDOUT: ; ModuleID = 'self.carbon' // CHECK:STDOUT: source_filename = "self.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CGet.C.Main(ptr %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CGet.C.Main(ptr %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc21_14.1.a = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %.loc21_14.2 = load i32, ptr %.loc21_14.1.a, align 4, !dbg !7 // CHECK:STDOUT: ret i32 %.loc21_14.2, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CSet.C.Main(ptr %self) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CSet.C.Main(ptr %self) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc25_7.a = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !10 // CHECK:STDOUT: store i32 1, ptr %.loc25_7.a, align 4, !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/class/self_addr.carbon b/toolchain/lower/testdata/class/self_addr.carbon index 860f228e302b7..9de728043c93e 100644 --- a/toolchain/lower/testdata/class/self_addr.carbon +++ b/toolchain/lower/testdata/class/self_addr.carbon @@ -28,20 +28,24 @@ fn C.Set[addr self: C*]() { // CHECK:STDOUT: ; ModuleID = 'self_addr.carbon' // CHECK:STDOUT: source_filename = "self_addr.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CGet.C.Main(ptr %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CGet.C.Main(ptr %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc21_14.1.a = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %.loc21_14.2 = load i32, ptr %.loc21_14.1.a, align 4, !dbg !7 // CHECK:STDOUT: ret i32 %.loc21_14.2, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CSet.C.Main(ptr %self) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CSet.C.Main(ptr %self) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc25_10.a = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !10 // CHECK:STDOUT: store i32 1, ptr %.loc25_10.a, align 4, !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/class/value_access.carbon b/toolchain/lower/testdata/class/value_access.carbon index 337f3107bbd40..19ebd770bd7f1 100644 --- a/toolchain/lower/testdata/class/value_access.carbon +++ b/toolchain/lower/testdata/class/value_access.carbon @@ -24,7 +24,8 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: ; ModuleID = 'value_access.carbon' // CHECK:STDOUT: source_filename = "value_access.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CF.Main(ptr %c) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CF.Main(ptr %c) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc21_11.1.a = getelementptr inbounds nuw { { i32, i32, i32 } }, ptr %c, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %tuple.elem0.tuple.elem = getelementptr inbounds nuw { i32, i32, i32 }, ptr %.loc21_11.1.a, i32 0, i32 0, !dbg !7 @@ -45,6 +46,8 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: ret i32 %tuple.elem1.loc21_13.tuple.elem.load, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/class/virtual.carbon b/toolchain/lower/testdata/class/virtual.carbon index 587c8ffd17a66..46fe251f18e14 100644 --- a/toolchain/lower/testdata/class/virtual.carbon +++ b/toolchain/lower/testdata/class/virtual.carbon @@ -160,16 +160,20 @@ fn Make() { // CHECK:STDOUT: @"_CIntermediate.Classes.$vtable" = unnamed_addr constant [1 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @_CFn.Intermediate.Classes to i64), i64 ptrtoint (ptr @"_CIntermediate.Classes.$vtable" to i64)) to i32)] // CHECK:STDOUT: @"_CDerived.Classes.$vtable" = unnamed_addr constant [1 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @_CFn.Derived.Classes to i64), i64 ptrtoint (ptr @"_CDerived.Classes.$vtable" to i64)) to i32)] // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CFn.Intermediate.Classes(ptr %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CFn.Intermediate.Classes(ptr %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CFn.Derived.Classes(ptr %self) !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CFn.Derived.Classes(ptr %self) #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -192,7 +196,8 @@ fn Make() { // CHECK:STDOUT: @Intermediate.val.ec2.loc8_3 = internal constant { ptr, {} } { ptr @"_CIntermediate.Classes.$vtable", {} zeroinitializer } // CHECK:STDOUT: @Derived.val.loc9_3 = internal constant { { ptr, {} } } { { ptr, {} } { ptr @"_CDerived.Classes.$vtable", {} zeroinitializer } } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CCreate.Create() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CCreate.Create() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %b.var = alloca {}, align 8, !dbg !7 // CHECK:STDOUT: %i.var = alloca { ptr, {} }, align 8, !dbg !8 @@ -217,7 +222,8 @@ fn Make() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CFn.Derived.Classes(ptr) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CUse.Create(ptr %v) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CUse.Create(ptr %v) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Intermediate.Fn.call.vtable = load ptr, ptr %v, align 8, !dbg !16 // CHECK:STDOUT: %Intermediate.Fn.call = call ptr @llvm.load.relative.i32(ptr %Intermediate.Fn.call.vtable, i32 0), !dbg !16 @@ -226,21 +232,22 @@ fn Make() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read) -// CHECK:STDOUT: declare ptr @llvm.load.relative.i32(ptr, i32) #2 +// CHECK:STDOUT: declare ptr @llvm.load.relative.i32(ptr, i32) #3 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 3, 2, 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -269,12 +276,14 @@ fn Make() { // CHECK:STDOUT: @"_CBase.MemberInit.$vtable" = unnamed_addr constant [1 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @_CFn.Base.MemberInit to i64), i64 ptrtoint (ptr @"_CBase.MemberInit.$vtable" to i64)) to i32)] // CHECK:STDOUT: @Base.val.loc13_3 = internal constant { ptr, i32 } { ptr @"_CBase.MemberInit.$vtable", i32 3 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CFn.Base.MemberInit(ptr %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CFn.Base.MemberInit(ptr %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CFn.MemberInit() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CFn.MemberInit() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %i.var = alloca i32, align 4, !dbg !9 // CHECK:STDOUT: %v.var = alloca { ptr, i32 }, align 8, !dbg !10 @@ -297,16 +306,17 @@ fn Make() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -337,7 +347,8 @@ fn Make() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CF.Base.Main(ptr) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CUse.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CUse.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %v.var = alloca { { ptr } }, align 8, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %v.var), !dbg !7 @@ -348,13 +359,14 @@ fn Make() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -377,7 +389,8 @@ fn Make() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CF.Base.Main(ptr) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CUse.Main(ptr %b) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CUse.Main(ptr %b) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Base.F.call.vtable = load ptr, ptr %b, align 8, !dbg !7 // CHECK:STDOUT: %Base.F.call = call ptr @llvm.load.relative.i32(ptr %Base.F.call.vtable, i32 0), !dbg !7 @@ -386,9 +399,10 @@ fn Make() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read) -// CHECK:STDOUT: declare ptr @llvm.load.relative.i32(ptr, i32) #0 +// CHECK:STDOUT: declare ptr @llvm.load.relative.i32(ptr, i32) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -413,7 +427,8 @@ fn Make() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CF.Derived.Main(ptr) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CUse.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CUse.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %v.var = alloca { { ptr } }, align 8, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %v.var), !dbg !7 @@ -427,17 +442,18 @@ fn Make() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read) -// CHECK:STDOUT: declare ptr @llvm.load.relative.i32(ptr, i32) #2 +// CHECK:STDOUT: declare ptr @llvm.load.relative.i32(ptr, i32) #3 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -472,7 +488,8 @@ fn Make() { // CHECK:STDOUT: @Base.val.58c.loc16_3 = internal constant { ptr } { ptr @"_CBase.Main.$vtable.b29a32b2b49cc0f3" } // CHECK:STDOUT: @Base.val.a96.loc17_3 = internal constant { ptr } { ptr @"_CBase.Main.$vtable.aa6c84e7fdd60e03" } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %t1.var = alloca { ptr }, align 8, !dbg !7 // CHECK:STDOUT: %t2.var = alloca { ptr }, align 8, !dbg !8 @@ -485,14 +502,16 @@ fn Make() { // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Base.Main.b29a32b2b49cc0f3(ptr %self) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Base.Main.b29a32b2b49cc0f3(ptr %self) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %v.var = alloca {}, align 8, !dbg !13 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %v.var), !dbg !13 // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Base.Main.aa6c84e7fdd60e03(ptr %self) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Base.Main.aa6c84e7fdd60e03(ptr %self) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %v.var = alloca { {} }, align 8, !dbg !16 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %v.var), !dbg !16 @@ -500,17 +519,18 @@ fn Make() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 3, 2, 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -538,22 +558,25 @@ fn Make() { // CHECK:STDOUT: // CHECK:STDOUT: @"_CDerived.Main.$vtable" = unnamed_addr constant [1 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @_CF.Base.Main.4d2ffa01ebfb7a1d to i64), i64 ptrtoint (ptr @"_CDerived.Main.$vtable" to i64)) to i32)] // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMake.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMake.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %v.var = alloca { { ptr } }, align 8, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %v.var), !dbg !7 // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Base.Main.4d2ffa01ebfb7a1d(ptr %self) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Base.Main.4d2ffa01ebfb7a1d(ptr %self) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/debug/nodebug.carbon b/toolchain/lower/testdata/debug/nodebug.carbon index d74815331a74f..dadccd1ea5192 100644 --- a/toolchain/lower/testdata/debug/nodebug.carbon +++ b/toolchain/lower/testdata/debug/nodebug.carbon @@ -17,7 +17,10 @@ fn F() { // CHECK:STDOUT: ; ModuleID = 'nodebug.carbon' // CHECK:STDOUT: source_filename = "nodebug.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main() { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } diff --git a/toolchain/lower/testdata/for/bindings.carbon b/toolchain/lower/testdata/for/bindings.carbon index 467d3d56e32b2..4d224a05dd7a4 100644 --- a/toolchain/lower/testdata/for/bindings.carbon +++ b/toolchain/lower/testdata/for/bindings.carbon @@ -38,7 +38,8 @@ fn For() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CF.Main(i32, ptr) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CFor.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CFor.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %r.var = alloca {}, align 8, !dbg !7 // CHECK:STDOUT: %var = alloca {}, align 8, !dbg !8 @@ -74,57 +75,66 @@ fn For() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CNewCursor.EmptyRange.Main:Iterate.Core.a862d5c8b748242e"(ptr %self) !dbg !13 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CNewCursor.EmptyRange.Main:Iterate.Core.a862d5c8b748242e"(ptr %self) #0 !dbg !13 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CNext.EmptyRange.Main:Iterate.Core.a862d5c8b748242e"(ptr sret({ { i32, i32 }, i1 }) %return, ptr %self, ptr %cursor) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CNext.EmptyRange.Main:Iterate.Core.a862d5c8b748242e"(ptr sret({ { i32, i32 }, i1 }) %return, ptr %self, ptr %cursor) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CNone.Optional.Core.7a2fd2277130880e(ptr %return), !dbg !16 // CHECK:STDOUT: ret void, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i1 @_CHasValue.Optional.Core.7a2fd2277130880e(ptr %self) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i1 @_CHasValue.Optional.Core.7a2fd2277130880e(ptr %self) #0 !dbg !18 { // CHECK:STDOUT: %1 = call i1 @"_CHas.225258f1a45e9386:OptionalStorage.Core.a862d5c8b748242e"(ptr %self), !dbg !20 // CHECK:STDOUT: ret i1 %1, !dbg !21 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CGet.Optional.Core.7a2fd2277130880e(ptr sret({ i32, i32 }) %return, ptr %self) !dbg !22 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CGet.Optional.Core.7a2fd2277130880e(ptr sret({ i32, i32 }) %return, ptr %self) #0 !dbg !22 { // CHECK:STDOUT: call void @"_CGet.225258f1a45e9386:OptionalStorage.Core.a862d5c8b748242e"(ptr %return, ptr %self), !dbg !23 // CHECK:STDOUT: ret void, !dbg !24 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CNone.Optional.Core.7a2fd2277130880e(ptr sret({ { i32, i32 }, i1 }) %return) !dbg !25 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CNone.Optional.Core.7a2fd2277130880e(ptr sret({ { i32, i32 }, i1 }) %return) #0 !dbg !25 { // CHECK:STDOUT: call void @"_CNone.225258f1a45e9386:OptionalStorage.Core.a862d5c8b748242e"(ptr %return), !dbg !26 // CHECK:STDOUT: ret void, !dbg !27 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i1 @"_CHas.225258f1a45e9386:OptionalStorage.Core.a862d5c8b748242e"(ptr %value) !dbg !28 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i1 @"_CHas.225258f1a45e9386:OptionalStorage.Core.a862d5c8b748242e"(ptr %value) #0 !dbg !28 { // CHECK:STDOUT: %has_value = getelementptr inbounds nuw { { i32, i32 }, i1 }, ptr %value, i32 0, i32 1, !dbg !29 // CHECK:STDOUT: %1 = load i8, ptr %has_value, align 1, !dbg !29 // CHECK:STDOUT: %2 = trunc i8 %1 to i1, !dbg !29 // CHECK:STDOUT: ret i1 %2, !dbg !30 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CGet.225258f1a45e9386:OptionalStorage.Core.a862d5c8b748242e"(ptr sret({ i32, i32 }) %return, ptr %value) !dbg !31 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CGet.225258f1a45e9386:OptionalStorage.Core.a862d5c8b748242e"(ptr sret({ i32, i32 }) %return, ptr %value) #0 !dbg !31 { // CHECK:STDOUT: %value1 = getelementptr inbounds nuw { { i32, i32 }, i1 }, ptr %value, i32 0, i32 0, !dbg !32 // CHECK:STDOUT: call void @"_COp.2b3ba83e01542f11:Copy.Core.4193728889277ad1"(ptr %return, ptr %value1), !dbg !32 // CHECK:STDOUT: ret void, !dbg !33 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CNone.225258f1a45e9386:OptionalStorage.Core.a862d5c8b748242e"(ptr sret({ { i32, i32 }, i1 }) %return) !dbg !34 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CNone.225258f1a45e9386:OptionalStorage.Core.a862d5c8b748242e"(ptr sret({ { i32, i32 }, i1 }) %return) #0 !dbg !34 { // CHECK:STDOUT: %has_value = getelementptr inbounds nuw { { i32, i32 }, i1 }, ptr %return, i32 0, i32 1, !dbg !35 // CHECK:STDOUT: store i8 0, ptr %has_value, align 1, !dbg !35 // CHECK:STDOUT: ret void, !dbg !36 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_COp.2b3ba83e01542f11:Copy.Core.4193728889277ad1"(ptr sret({ i32, i32 }) %return, ptr %self) !dbg !37 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_COp.2b3ba83e01542f11:Copy.Core.4193728889277ad1"(ptr sret({ i32, i32 }) %return, ptr %self) #0 !dbg !37 { // CHECK:STDOUT: %tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 0, !dbg !39 // CHECK:STDOUT: %tuple.elem.load = load i32, ptr %tuple.elem, align 4, !dbg !39 // CHECK:STDOUT: %tuple.elem1 = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !40 @@ -139,8 +149,9 @@ fn For() { // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/for/break_continue.carbon b/toolchain/lower/testdata/for/break_continue.carbon index 667f8de3ca8f7..34d8450ddc6c3 100644 --- a/toolchain/lower/testdata/for/break_continue.carbon +++ b/toolchain/lower/testdata/for/break_continue.carbon @@ -33,7 +33,8 @@ fn For() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CH.Main() // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CFor.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CFor.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc20_32.1.temp = alloca { i32, i32 }, align 8, !dbg !7 // CHECK:STDOUT: %var = alloca i32, align 4, !dbg !8 @@ -77,15 +78,17 @@ fn For() { // CHECK:STDOUT: declare void @_CRange.Core(ptr sret({ i32, i32 }), i32) // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @"_CNewCursor.IntRange.Core:Iterate.Core.be1e879c1ad406d8"(ptr %self) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @"_CNewCursor.IntRange.Core:Iterate.Core.be1e879c1ad406d8"(ptr %self) #0 !dbg !18 { // CHECK:STDOUT: %start = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 0, !dbg !20 // CHECK:STDOUT: %1 = load i32, ptr %start, align 4, !dbg !20 // CHECK:STDOUT: ret i32 %1, !dbg !21 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CNext.IntRange.Core:Iterate.Core.be1e879c1ad406d8"(ptr sret({ i32, i1 }) %return, ptr %self, ptr %cursor) !dbg !22 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CNext.IntRange.Core:Iterate.Core.be1e879c1ad406d8"(ptr sret({ i32, i1 }) %return, ptr %self, ptr %cursor) #0 !dbg !22 { // CHECK:STDOUT: %1 = alloca i32, align 4, !dbg !23 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %1), !dbg !23 // CHECK:STDOUT: %2 = load i32, ptr %cursor, align 4, !dbg !24 @@ -107,47 +110,55 @@ fn For() { // CHECK:STDOUT: ret void, !dbg !33 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i1 @_CHasValue.Optional.Core.c1b882a73b8b9531(ptr %self) !dbg !34 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i1 @_CHasValue.Optional.Core.c1b882a73b8b9531(ptr %self) #0 !dbg !34 { // CHECK:STDOUT: %1 = call i1 @"_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %self), !dbg !36 // CHECK:STDOUT: ret i1 %1, !dbg !37 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CGet.Optional.Core.c1b882a73b8b9531(ptr %self) !dbg !38 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CGet.Optional.Core.c1b882a73b8b9531(ptr %self) #0 !dbg !38 { // CHECK:STDOUT: %1 = call i32 @"_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %self), !dbg !39 // CHECK:STDOUT: ret i32 %1, !dbg !40 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CInclusiveRange.Core(ptr sret({ i32, i32 }), i32, i32) // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_COp.Int.Core:Inc.Core.be1e879c1ad406d8"(ptr %self) !dbg !41 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_COp.Int.Core:Inc.Core.be1e879c1ad406d8"(ptr %self) #0 !dbg !41 { // CHECK:STDOUT: call void @"_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e"(ptr %self, i32 1), !dbg !43 // CHECK:STDOUT: ret void, !dbg !44 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CSome.Optional.Core.c1b882a73b8b9531(ptr sret({ i32, i1 }) %return, i32 %value) !dbg !45 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CSome.Optional.Core.c1b882a73b8b9531(ptr sret({ i32, i1 }) %return, i32 %value) #0 !dbg !45 { // CHECK:STDOUT: call void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %return, i32 %value), !dbg !46 // CHECK:STDOUT: ret void, !dbg !47 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CNone.Optional.Core.c1b882a73b8b9531(ptr sret({ i32, i1 }) %return) !dbg !48 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CNone.Optional.Core.c1b882a73b8b9531(ptr sret({ i32, i1 }) %return) #0 !dbg !48 { // CHECK:STDOUT: call void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %return), !dbg !49 // CHECK:STDOUT: ret void, !dbg !50 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i1 @"_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %value) !dbg !51 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i1 @"_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %value) #0 !dbg !51 { // CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %value, i32 0, i32 1, !dbg !52 // CHECK:STDOUT: %1 = load i8, ptr %has_value, align 1, !dbg !52 // CHECK:STDOUT: %2 = trunc i8 %1 to i1, !dbg !52 // CHECK:STDOUT: ret i1 %2, !dbg !53 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @"_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %value) !dbg !54 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @"_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %value) #0 !dbg !54 { // CHECK:STDOUT: %value1 = getelementptr inbounds nuw { i32, i1 }, ptr %value, i32 0, i32 0, !dbg !55 // CHECK:STDOUT: %1 = load i32, ptr %value1, align 4, !dbg !55 // CHECK:STDOUT: ret i32 %1, !dbg !56 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e"(ptr %self, i32 %other) !dbg !57 { +// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind +// CHECK:STDOUT: define linkonce_odr void @"_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e"(ptr %self, i32 %other) #2 !dbg !57 { // CHECK:STDOUT: %1 = call i32 @"_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899"(i32 %other), !dbg !58 // CHECK:STDOUT: %2 = load i32, ptr %self, align 4, !dbg !59 // CHECK:STDOUT: %3 = add i32 %2, %1, !dbg !59 @@ -155,7 +166,8 @@ fn For() { // CHECK:STDOUT: ret void, !dbg !59 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return, i32 %self) !dbg !60 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !60 { // CHECK:STDOUT: %value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 0, !dbg !61 // CHECK:STDOUT: store i32 %self, ptr %value, align 4, !dbg !61 // CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 1, !dbg !62 @@ -163,20 +175,24 @@ fn For() { // CHECK:STDOUT: ret void, !dbg !63 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return) !dbg !64 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return) #0 !dbg !64 { // CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 1, !dbg !65 // CHECK:STDOUT: store i8 0, ptr %has_value, align 1, !dbg !65 // CHECK:STDOUT: ret void, !dbg !66 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @"_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899"(i32 %self) !dbg !67 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @"_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899"(i32 %self) #0 !dbg !67 { // CHECK:STDOUT: ret i32 %self, !dbg !69 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 0, 3, 2, 1 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { alwaysinline nounwind } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/for/for.carbon b/toolchain/lower/testdata/for/for.carbon index f8fe762f42e3b..f7577a60e0a2a 100644 --- a/toolchain/lower/testdata/for/for.carbon +++ b/toolchain/lower/testdata/for/for.carbon @@ -33,7 +33,8 @@ fn For() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CH.Main() // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CFor.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CFor.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc21_32.1.temp = alloca { i32, i32 }, align 8, !dbg !7 // CHECK:STDOUT: %var = alloca i32, align 4, !dbg !8 @@ -65,15 +66,17 @@ fn For() { // CHECK:STDOUT: declare void @_CRange.Core(ptr sret({ i32, i32 }), i32) // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @"_CNewCursor.IntRange.Core:Iterate.Core.be1e879c1ad406d8"(ptr %self) !dbg !14 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @"_CNewCursor.IntRange.Core:Iterate.Core.be1e879c1ad406d8"(ptr %self) #0 !dbg !14 { // CHECK:STDOUT: %start = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 0, !dbg !16 // CHECK:STDOUT: %1 = load i32, ptr %start, align 4, !dbg !16 // CHECK:STDOUT: ret i32 %1, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CNext.IntRange.Core:Iterate.Core.be1e879c1ad406d8"(ptr sret({ i32, i1 }) %return, ptr %self, ptr %cursor) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CNext.IntRange.Core:Iterate.Core.be1e879c1ad406d8"(ptr sret({ i32, i1 }) %return, ptr %self, ptr %cursor) #0 !dbg !18 { // CHECK:STDOUT: %1 = alloca i32, align 4, !dbg !19 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %1), !dbg !19 // CHECK:STDOUT: %2 = load i32, ptr %cursor, align 4, !dbg !20 @@ -95,47 +98,55 @@ fn For() { // CHECK:STDOUT: ret void, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i1 @_CHasValue.Optional.Core.c1b882a73b8b9531(ptr %self) !dbg !30 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i1 @_CHasValue.Optional.Core.c1b882a73b8b9531(ptr %self) #0 !dbg !30 { // CHECK:STDOUT: %1 = call i1 @"_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %self), !dbg !32 // CHECK:STDOUT: ret i1 %1, !dbg !33 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CGet.Optional.Core.c1b882a73b8b9531(ptr %self) !dbg !34 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CGet.Optional.Core.c1b882a73b8b9531(ptr %self) #0 !dbg !34 { // CHECK:STDOUT: %1 = call i32 @"_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %self), !dbg !35 // CHECK:STDOUT: ret i32 %1, !dbg !36 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CInclusiveRange.Core(ptr sret({ i32, i32 }), i32, i32) // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_COp.Int.Core:Inc.Core.be1e879c1ad406d8"(ptr %self) !dbg !37 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_COp.Int.Core:Inc.Core.be1e879c1ad406d8"(ptr %self) #0 !dbg !37 { // CHECK:STDOUT: call void @"_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e"(ptr %self, i32 1), !dbg !39 // CHECK:STDOUT: ret void, !dbg !40 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CSome.Optional.Core.c1b882a73b8b9531(ptr sret({ i32, i1 }) %return, i32 %value) !dbg !41 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CSome.Optional.Core.c1b882a73b8b9531(ptr sret({ i32, i1 }) %return, i32 %value) #0 !dbg !41 { // CHECK:STDOUT: call void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %return, i32 %value), !dbg !42 // CHECK:STDOUT: ret void, !dbg !43 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CNone.Optional.Core.c1b882a73b8b9531(ptr sret({ i32, i1 }) %return) !dbg !44 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CNone.Optional.Core.c1b882a73b8b9531(ptr sret({ i32, i1 }) %return) #0 !dbg !44 { // CHECK:STDOUT: call void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %return), !dbg !45 // CHECK:STDOUT: ret void, !dbg !46 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i1 @"_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %value) !dbg !47 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i1 @"_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %value) #0 !dbg !47 { // CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %value, i32 0, i32 1, !dbg !48 // CHECK:STDOUT: %1 = load i8, ptr %has_value, align 1, !dbg !48 // CHECK:STDOUT: %2 = trunc i8 %1 to i1, !dbg !48 // CHECK:STDOUT: ret i1 %2, !dbg !49 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @"_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %value) !dbg !50 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @"_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %value) #0 !dbg !50 { // CHECK:STDOUT: %value1 = getelementptr inbounds nuw { i32, i1 }, ptr %value, i32 0, i32 0, !dbg !51 // CHECK:STDOUT: %1 = load i32, ptr %value1, align 4, !dbg !51 // CHECK:STDOUT: ret i32 %1, !dbg !52 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e"(ptr %self, i32 %other) !dbg !53 { +// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind +// CHECK:STDOUT: define linkonce_odr void @"_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e"(ptr %self, i32 %other) #2 !dbg !53 { // CHECK:STDOUT: %1 = call i32 @"_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899"(i32 %other), !dbg !54 // CHECK:STDOUT: %2 = load i32, ptr %self, align 4, !dbg !55 // CHECK:STDOUT: %3 = add i32 %2, %1, !dbg !55 @@ -143,7 +154,8 @@ fn For() { // CHECK:STDOUT: ret void, !dbg !55 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return, i32 %self) !dbg !56 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !56 { // CHECK:STDOUT: %value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 0, !dbg !57 // CHECK:STDOUT: store i32 %self, ptr %value, align 4, !dbg !57 // CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 1, !dbg !58 @@ -151,20 +163,24 @@ fn For() { // CHECK:STDOUT: ret void, !dbg !59 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return) !dbg !60 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return) #0 !dbg !60 { // CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 1, !dbg !61 // CHECK:STDOUT: store i8 0, ptr %has_value, align 1, !dbg !61 // CHECK:STDOUT: ret void, !dbg !62 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @"_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899"(i32 %self) !dbg !63 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @"_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899"(i32 %self) #0 !dbg !63 { // CHECK:STDOUT: ret i32 %self, !dbg !65 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 0, 3, 2, 1 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { alwaysinline nounwind } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/call/empty_struct.carbon b/toolchain/lower/testdata/function/call/empty_struct.carbon index f00f495ad5cb0..ff9c1e0a208cf 100644 --- a/toolchain/lower/testdata/function/call/empty_struct.carbon +++ b/toolchain/lower/testdata/function/call/empty_struct.carbon @@ -21,12 +21,14 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'empty_struct.carbon' // CHECK:STDOUT: source_filename = "empty_struct.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CEcho.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CEcho.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %b.var = alloca {}, align 8, !dbg !9 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %b.var), !dbg !9 @@ -35,9 +37,10 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/call/empty_tuple.carbon b/toolchain/lower/testdata/function/call/empty_tuple.carbon index 85a023d3fe81e..3ac5b07396c94 100644 --- a/toolchain/lower/testdata/function/call/empty_tuple.carbon +++ b/toolchain/lower/testdata/function/call/empty_tuple.carbon @@ -21,12 +21,14 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'empty_tuple.carbon' // CHECK:STDOUT: source_filename = "empty_tuple.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CEcho.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CEcho.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %b.var = alloca {}, align 8, !dbg !9 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %b.var), !dbg !9 @@ -35,9 +37,10 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/call/i32.carbon b/toolchain/lower/testdata/function/call/i32.carbon index 10534d0b9a3f2..470e2a848ca78 100644 --- a/toolchain/lower/testdata/function/call/i32.carbon +++ b/toolchain/lower/testdata/function/call/i32.carbon @@ -21,12 +21,14 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'i32.carbon' // CHECK:STDOUT: source_filename = "i32.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CEcho.Main(i32 %a) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CEcho.Main(i32 %a) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 %a, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %b.var = alloca i32, align 4, !dbg !9 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %b.var), !dbg !9 @@ -36,9 +38,10 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/call/implicit_empty_tuple_as_arg.carbon b/toolchain/lower/testdata/function/call/implicit_empty_tuple_as_arg.carbon index d1af6a3af67e1..510f2854a818f 100644 --- a/toolchain/lower/testdata/function/call/implicit_empty_tuple_as_arg.carbon +++ b/toolchain/lower/testdata/function/call/implicit_empty_tuple_as_arg.carbon @@ -22,17 +22,20 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'implicit_empty_tuple_as_arg.carbon' // CHECK:STDOUT: source_filename = "implicit_empty_tuple_as_arg.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CFoo.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CFoo.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CBar.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CBar.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca {}, align 8, !dbg !11 // CHECK:STDOUT: %.loc19_23.1.temp = alloca {}, align 8, !dbg !12 @@ -44,12 +47,13 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/call/params_one.carbon b/toolchain/lower/testdata/function/call/params_one.carbon index 7084264ccdd54..c23ddee724630 100644 --- a/toolchain/lower/testdata/function/call/params_one.carbon +++ b/toolchain/lower/testdata/function/call/params_one.carbon @@ -19,17 +19,21 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'params_one.carbon' // CHECK:STDOUT: source_filename = "params_one.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CFoo.Main(i32 %a) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CFoo.Main(i32 %a) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CFoo.Main(i32 1), !dbg !9 // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/call/params_one_comma.carbon b/toolchain/lower/testdata/function/call/params_one_comma.carbon index 1b9a9b1a425c0..b95acf4adda0e 100644 --- a/toolchain/lower/testdata/function/call/params_one_comma.carbon +++ b/toolchain/lower/testdata/function/call/params_one_comma.carbon @@ -20,18 +20,22 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'params_one_comma.carbon' // CHECK:STDOUT: source_filename = "params_one_comma.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CFoo.Main(i32 %a) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CFoo.Main(i32 %a) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CFoo.Main(i32 1), !dbg !9 // CHECK:STDOUT: call void @_CFoo.Main(i32 1), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/call/params_two.carbon b/toolchain/lower/testdata/function/call/params_two.carbon index addad4c475bf6..58b132459423c 100644 --- a/toolchain/lower/testdata/function/call/params_two.carbon +++ b/toolchain/lower/testdata/function/call/params_two.carbon @@ -19,17 +19,21 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'params_two.carbon' // CHECK:STDOUT: source_filename = "params_two.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CFoo.Main(i32 %a, i32 %b) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CFoo.Main(i32 %a, i32 %b) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CFoo.Main(i32 1, i32 2), !dbg !9 // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/call/params_two_comma.carbon b/toolchain/lower/testdata/function/call/params_two_comma.carbon index bea1c420ae243..f6e5dfaca060f 100644 --- a/toolchain/lower/testdata/function/call/params_two_comma.carbon +++ b/toolchain/lower/testdata/function/call/params_two_comma.carbon @@ -20,18 +20,22 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'params_two_comma.carbon' // CHECK:STDOUT: source_filename = "params_two_comma.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CFoo.Main(i32 %a, i32 %b) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CFoo.Main(i32 %a, i32 %b) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CFoo.Main(i32 1, i32 2), !dbg !9 // CHECK:STDOUT: call void @_CFoo.Main(i32 1, i32 2), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/call/params_zero.carbon b/toolchain/lower/testdata/function/call/params_zero.carbon index 99e17a0d40b98..7fe2f627cc79a 100644 --- a/toolchain/lower/testdata/function/call/params_zero.carbon +++ b/toolchain/lower/testdata/function/call/params_zero.carbon @@ -19,17 +19,21 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'params_zero.carbon' // CHECK:STDOUT: source_filename = "params_zero.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CFoo.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CFoo.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CFoo.Main(), !dbg !9 // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/call/ref_param.carbon b/toolchain/lower/testdata/function/call/ref_param.carbon index 665ebd1ff36a2..7d67489e4254d 100644 --- a/toolchain/lower/testdata/function/call/ref_param.carbon +++ b/toolchain/lower/testdata/function/call/ref_param.carbon @@ -20,12 +20,14 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'ref_param.carbon' // CHECK:STDOUT: source_filename = "ref_param.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CDoNothing.Main(ptr %a) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CDoNothing.Main(ptr %a) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca i32, align 4, !dbg !9 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %a.var), !dbg !9 @@ -35,9 +37,10 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/call/return_implicit.carbon b/toolchain/lower/testdata/function/call/return_implicit.carbon index 007fa4648050b..1f464de6278b7 100644 --- a/toolchain/lower/testdata/function/call/return_implicit.carbon +++ b/toolchain/lower/testdata/function/call/return_implicit.carbon @@ -21,12 +21,14 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'return_implicit.carbon' // CHECK:STDOUT: source_filename = "return_implicit.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMakeImplicitEmptyTuple.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMakeImplicitEmptyTuple.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %b.var = alloca {}, align 8, !dbg !9 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %b.var), !dbg !9 @@ -35,9 +37,10 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/call/struct_param.carbon b/toolchain/lower/testdata/function/call/struct_param.carbon index 9f9336a305744..6f95e56f998b1 100644 --- a/toolchain/lower/testdata/function/call/struct_param.carbon +++ b/toolchain/lower/testdata/function/call/struct_param.carbon @@ -21,17 +21,21 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: @struct.9ae.loc16_34.6 = internal constant { i32, i32 } { i32 2, i32 3 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main({ i32 } %b, ptr %c) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main({ i32 } %b, ptr %c) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CF.Main({ i32 } { i32 1 }, ptr @struct.9ae.loc16_34.6), !dbg !9 // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/call/tuple_param.carbon b/toolchain/lower/testdata/function/call/tuple_param.carbon index e9316dfbe5dbb..86fdb700f235a 100644 --- a/toolchain/lower/testdata/function/call/tuple_param.carbon +++ b/toolchain/lower/testdata/function/call/tuple_param.carbon @@ -21,17 +21,21 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: @tuple.11a.loc16_20.6 = internal constant { i32, i32 } { i32 2, i32 3 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main({ i32 } %b, ptr %c) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main({ i32 } %b, ptr %c) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CF.Main({ i32 } { i32 1 }, ptr @tuple.11a.loc16_20.6), !dbg !9 // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon b/toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon index 9ec0bf62f5d1f..a25b6db716d11 100644 --- a/toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon +++ b/toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon @@ -23,7 +23,8 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: @tuple.11a.loc18_20.6 = internal constant { i32, i32 } { i32 2, i32 3 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main(ptr sret({ i32, i32, i32 }) %return, { i32 } %b, ptr %c) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main(ptr sret({ i32, i32, i32 }) %return, { i32 } %b, ptr %c) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %tuple.elem0.loc14_12.tuple.elem = extractvalue { i32 } %b, 0, !dbg !7 // CHECK:STDOUT: %tuple.elem0.loc14_17.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %c, i32 0, i32 0, !dbg !8 @@ -39,7 +40,8 @@ fn Main() { // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc18_21.1.temp = alloca { i32, i32, i32 }, align 8, !dbg !13 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc18_21.1.temp), !dbg !13 @@ -48,9 +50,10 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/call/var_param.carbon b/toolchain/lower/testdata/function/call/var_param.carbon index 6886e52cfa02b..dea9c76f63c25 100644 --- a/toolchain/lower/testdata/function/call/var_param.carbon +++ b/toolchain/lower/testdata/function/call/var_param.carbon @@ -20,12 +20,14 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'var_param.carbon' // CHECK:STDOUT: source_filename = "var_param.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CDoNothing.Main(i32 %a) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CDoNothing.Main(i32 %a) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca i32, align 4, !dbg !9 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %a.var), !dbg !9 @@ -36,9 +38,10 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/declaration/simple.carbon b/toolchain/lower/testdata/function/declaration/simple.carbon index 39504d566bb9d..556bb55c425ae 100644 --- a/toolchain/lower/testdata/function/declaration/simple.carbon +++ b/toolchain/lower/testdata/function/declaration/simple.carbon @@ -23,7 +23,8 @@ fn I() -> A; // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CF.Main(i32) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CG.Main(i32 %n) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CG.Main(i32 %n) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CF.Main(i32 %n), !dbg !7 // CHECK:STDOUT: ret void, !dbg !8 @@ -33,6 +34,8 @@ fn I() -> A; // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CI.Main() // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/definition/destroy.carbon b/toolchain/lower/testdata/function/definition/destroy.carbon index 26bca5ffc55f9..f305f9b88f7b2 100644 --- a/toolchain/lower/testdata/function/definition/destroy.carbon +++ b/toolchain/lower/testdata/function/definition/destroy.carbon @@ -77,14 +77,16 @@ fn InitLet() { // CHECK:STDOUT: // CHECK:STDOUT: @C.val.loc12_6.3 = internal constant {} zeroinitializer // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main(ptr %x) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main(ptr %x) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CG.Main() // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CCallF.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CCallF.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc12_6.2.temp = alloca {}, align 8, !dbg !9 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc12_6.2.temp), !dbg !9 @@ -95,13 +97,14 @@ fn InitLet() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -124,14 +127,16 @@ fn InitLet() { // CHECK:STDOUT: // CHECK:STDOUT: @C.val.loc6_6.2 = internal constant {} zeroinitializer // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main(ptr %x) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main(ptr %x) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CG.Main() // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CCallF.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CCallF.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc6_6.1.temp = alloca {}, align 8, !dbg !9 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc6_6.1.temp), !dbg !9 @@ -142,13 +147,14 @@ fn InitLet() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -171,7 +177,8 @@ fn InitLet() { // CHECK:STDOUT: // CHECK:STDOUT: @C.val.loc7_12 = internal constant {} zeroinitializer // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main(ptr sret({}) %return) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main(ptr sret({}) %return) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %return, ptr align 1 @C.val.loc7_12, i64 0, i1 false), !dbg !7 // CHECK:STDOUT: ret void, !dbg !7 @@ -179,13 +186,15 @@ fn InitLet() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CG.Main() // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CForward.Main(ptr sret({}) %return) !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CForward.Main(ptr sret({}) %return) #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CF.Main(ptr %return), !dbg !9 // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CInitVar.Main() !dbg !11 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CInitVar.Main() #0 !dbg !11 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %local.var = alloca {}, align 8, !dbg !12 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %local.var), !dbg !12 @@ -194,7 +203,8 @@ fn InitLet() { // CHECK:STDOUT: ret void, !dbg !15 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CInitLet.Main() !dbg !16 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CInitLet.Main() #0 !dbg !16 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc22_20.1.temp = alloca {}, align 8, !dbg !17 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc22_20.1.temp), !dbg !17 @@ -204,16 +214,17 @@ fn InitLet() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/definition/empty_struct.carbon b/toolchain/lower/testdata/function/definition/empty_struct.carbon index 686e634023539..3e1585a2262e1 100644 --- a/toolchain/lower/testdata/function/definition/empty_struct.carbon +++ b/toolchain/lower/testdata/function/definition/empty_struct.carbon @@ -16,11 +16,14 @@ fn Echo(a: {}) { // CHECK:STDOUT: ; ModuleID = 'empty_struct.carbon' // CHECK:STDOUT: source_filename = "empty_struct.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CEcho.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CEcho.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/definition/params_one.carbon b/toolchain/lower/testdata/function/definition/params_one.carbon index d299842d23ccb..a7a850b50bfaa 100644 --- a/toolchain/lower/testdata/function/definition/params_one.carbon +++ b/toolchain/lower/testdata/function/definition/params_one.carbon @@ -15,11 +15,14 @@ fn Foo(a: i32) {} // CHECK:STDOUT: ; ModuleID = 'params_one.carbon' // CHECK:STDOUT: source_filename = "params_one.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CFoo.Main(i32 %a) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CFoo.Main(i32 %a) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/definition/params_two.carbon b/toolchain/lower/testdata/function/definition/params_two.carbon index 8248fffffcba4..0285197f768cb 100644 --- a/toolchain/lower/testdata/function/definition/params_two.carbon +++ b/toolchain/lower/testdata/function/definition/params_two.carbon @@ -15,11 +15,14 @@ fn Foo(a: i32, b: i32) {} // CHECK:STDOUT: ; ModuleID = 'params_two.carbon' // CHECK:STDOUT: source_filename = "params_two.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CFoo.Main(i32 %a, i32 %b) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CFoo.Main(i32 %a, i32 %b) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/definition/params_zero.carbon b/toolchain/lower/testdata/function/definition/params_zero.carbon index 03dd26b9d7f12..dd5ae6ee553b3 100644 --- a/toolchain/lower/testdata/function/definition/params_zero.carbon +++ b/toolchain/lower/testdata/function/definition/params_zero.carbon @@ -15,11 +15,14 @@ fn Foo() {} // CHECK:STDOUT: ; ModuleID = 'params_zero.carbon' // CHECK:STDOUT: source_filename = "params_zero.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CFoo.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CFoo.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/definition/raw_name.carbon b/toolchain/lower/testdata/function/definition/raw_name.carbon index c5e26d2806417..296c384a22984 100644 --- a/toolchain/lower/testdata/function/definition/raw_name.carbon +++ b/toolchain/lower/testdata/function/definition/raw_name.carbon @@ -16,11 +16,14 @@ fn r#self() {} // CHECK:STDOUT: ; ModuleID = 'raw_name.carbon' // CHECK:STDOUT: source_filename = "raw_name.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_Cself.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_Cself.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/definition/var_param.carbon b/toolchain/lower/testdata/function/definition/var_param.carbon index a74f980136474..391d6e6b80d60 100644 --- a/toolchain/lower/testdata/function/definition/var_param.carbon +++ b/toolchain/lower/testdata/function/definition/var_param.carbon @@ -33,32 +33,38 @@ fn Call() { // CHECK:STDOUT: // CHECK:STDOUT: @X.val.loc16_13.2 = internal constant {} zeroinitializer // CHECK:STDOUT: -// CHECK:STDOUT: define void @_COneVar_i32.Main(ptr %n) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_COneVar_i32.Main(ptr %n) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_COneVar_X.Main(ptr %x) !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_COneVar_X.Main(ptr %x) #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTwoVars.Main(ptr %a, ptr %b) !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTwoVars.Main(ptr %a, ptr %b) #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CVarThenLet.Main(ptr %a, ptr %b) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CVarThenLet.Main(ptr %a, ptr %b) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CLetThenVar.Main(i32 %a, ptr %b) !dbg !14 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CLetThenVar.Main(i32 %a, ptr %b) #0 !dbg !14 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !15 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CCall.Main() !dbg !16 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CCall.Main() #0 !dbg !16 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc15_15.1.temp = alloca i32, align 4, !dbg !17 // CHECK:STDOUT: %.loc16_13.1.temp = alloca {}, align 8, !dbg !18 @@ -90,17 +96,18 @@ fn Call() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 6, 5, 4, 3, 2, 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/call.carbon b/toolchain/lower/testdata/function/generic/call.carbon index f4c5068a7c9d6..4a33fd36f533e 100644 --- a/toolchain/lower/testdata/function/generic/call.carbon +++ b/toolchain/lower/testdata/function/generic/call.carbon @@ -37,7 +37,8 @@ fn G() { // CHECK:STDOUT: @C.val.loc20_3 = internal constant {} zeroinitializer // CHECK:STDOUT: @D.val.loc21_3 = internal constant {} zeroinitializer // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CG.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CG.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c.var = alloca {}, align 8, !dbg !7 // CHECK:STDOUT: %d.var = alloca {}, align 8, !dbg !8 @@ -62,27 +63,31 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Main.15b1f98bd9cc0c5b(ptr %x) !dbg !19 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Main.15b1f98bd9cc0c5b(ptr %x) #0 !dbg !19 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Main.b88d1103f417c6d4(i32 %x) !dbg !21 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Main.b88d1103f417c6d4(i32 %x) #0 !dbg !21 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !22 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Main.d4b5665541d5d7a8(double %x) !dbg !23 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Main.d4b5665541d5d7a8(double %x) #0 !dbg !23 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !24 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Main.5754c7a55c7cbe4a(%type %x) !dbg !25 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Main.5754c7a55c7cbe4a(%type %x) #0 !dbg !25 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !26 // CHECK:STDOUT: } @@ -92,8 +97,9 @@ fn G() { // CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 1, 0 } // CHECK:STDOUT: uselistorder ptr @_CF.Main.15b1f98bd9cc0c5b, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/call_basic.carbon b/toolchain/lower/testdata/function/generic/call_basic.carbon index 34f3a6146c7dd..e78dbb086cf01 100644 --- a/toolchain/lower/testdata/function/generic/call_basic.carbon +++ b/toolchain/lower/testdata/function/generic/call_basic.carbon @@ -64,13 +64,15 @@ fn M() { // CHECK:STDOUT: // CHECK:STDOUT: @C.val.loc15_44 = internal constant {} zeroinitializer // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_COp.C.Main:Copy.Core"(ptr sret({}) %return, ptr %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_COp.C.Main:Copy.Core"(ptr sret({}) %return, ptr %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %return, ptr align 1 @C.val.loc15_44, i64 0, i1 false), !dbg !7 // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CM.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CM.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !9 // CHECK:STDOUT: %m.var = alloca i32, align 4, !dbg !10 @@ -96,17 +98,19 @@ fn M() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Main.b88d1103f417c6d4(i32 %x) !dbg !24 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Main.b88d1103f417c6d4(i32 %x) #0 !dbg !24 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !25 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CG.Main.d756e33fa3337243(i32 %x) !dbg !26 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CG.Main.d756e33fa3337243(i32 %x) #0 !dbg !26 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc29_6.3.temp = alloca i32, align 4, !dbg !27 // CHECK:STDOUT: %.loc31_8.3.temp = alloca i32, align 4, !dbg !28 @@ -146,12 +150,14 @@ fn M() { // CHECK:STDOUT: ret i32 %x, !dbg !45 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Main.d4b5665541d5d7a8(double %x) !dbg !46 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Main.d4b5665541d5d7a8(double %x) #0 !dbg !46 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !47 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CG.Main.6765264419ed942e(double %x) !dbg !48 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CG.Main.6765264419ed942e(double %x) #0 !dbg !48 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc29_6.3.temp = alloca double, align 8, !dbg !49 // CHECK:STDOUT: %.loc31_8.3.temp = alloca double, align 8, !dbg !50 @@ -191,27 +197,32 @@ fn M() { // CHECK:STDOUT: ret double %x, !dbg !67 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CH.Main.5450dc8e8b8e0899(i32 %x) !dbg !68 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CH.Main.5450dc8e8b8e0899(i32 %x) #0 !dbg !68 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 %x, !dbg !69 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr %type @_CH.Main.402deed6b8733082(%type %x) !dbg !70 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr %type @_CH.Main.402deed6b8733082(%type %x) #0 !dbg !70 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret %type %x, !dbg !71 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CH.Main.83aece103b0a8681(double %x) !dbg !72 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CH.Main.83aece103b0a8681(double %x) #0 !dbg !72 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret double %x, !dbg !73 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CH.Main.0a952f8bcc623ce6(ptr %x) !dbg !74 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CH.Main.0a952f8bcc623ce6(ptr %x) #0 !dbg !74 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret ptr %x, !dbg !75 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CH.Main.936d996ea935415c(ptr sret({}) %return, ptr %x) !dbg !76 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CH.Main.936d996ea935415c(ptr sret({}) %return, ptr %x) #0 !dbg !76 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @"_COp.C.Main:Copy.Core"(ptr %return, ptr %x), !dbg !77 // CHECK:STDOUT: ret void, !dbg !78 @@ -225,8 +236,9 @@ fn M() { // CHECK:STDOUT: uselistorder ptr @_CH.Main.0a952f8bcc623ce6, { 5, 2, 0, 4, 3, 1 } // CHECK:STDOUT: uselistorder ptr @_CH.Main.936d996ea935415c, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/call_basic_depth.carbon b/toolchain/lower/testdata/function/generic/call_basic_depth.carbon index 34d920c7e10ce..615ee7cd53217 100644 --- a/toolchain/lower/testdata/function/generic/call_basic_depth.carbon +++ b/toolchain/lower/testdata/function/generic/call_basic_depth.carbon @@ -38,7 +38,8 @@ fn M() { // CHECK:STDOUT: ; ModuleID = 'call_basic_depth.carbon' // CHECK:STDOUT: source_filename = "call_basic_depth.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CM.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CM.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !7 // CHECK:STDOUT: %m.var = alloca i32, align 4, !dbg !8 @@ -54,14 +55,16 @@ fn M() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Main.b88d1103f417c6d4(i32 %x) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Main.b88d1103f417c6d4(i32 %x) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !16 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CG.Main.d756e33fa3337243(i32 %x) !dbg !17 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CG.Main.d756e33fa3337243(i32 %x) #0 !dbg !17 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc25_6.3.temp = alloca i32, align 4, !dbg !18 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc25_6.3.temp), !dbg !18 @@ -71,7 +74,8 @@ fn M() { // CHECK:STDOUT: ret i32 %x, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CH.Main.5450dc8e8b8e0899(i32 %x) !dbg !21 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CH.Main.5450dc8e8b8e0899(i32 %x) #0 !dbg !21 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CF.Main.b88d1103f417c6d4(i32 %x), !dbg !22 // CHECK:STDOUT: ret i32 %x, !dbg !23 @@ -80,7 +84,8 @@ fn M() { // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 0, 2, 1 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/call_dedup_ptr.carbon b/toolchain/lower/testdata/function/generic/call_dedup_ptr.carbon index 8c748f1a44a9b..1c015883ec6b0 100644 --- a/toolchain/lower/testdata/function/generic/call_dedup_ptr.carbon +++ b/toolchain/lower/testdata/function/generic/call_dedup_ptr.carbon @@ -26,7 +26,8 @@ fn M() { // CHECK:STDOUT: ; ModuleID = 'call_dedup_ptr.carbon' // CHECK:STDOUT: source_filename = "call_dedup_ptr.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CM.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CM.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ptr_i32.var = alloca ptr, align 8, !dbg !7 // CHECK:STDOUT: %ptr_f64.var = alloca ptr, align 8, !dbg !8 @@ -44,9 +45,10 @@ fn M() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CF.Main.0a952f8bcc623ce6(ptr %x) !dbg !17 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CF.Main.0a952f8bcc623ce6(ptr %x) #0 !dbg !17 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret ptr %x, !dbg !18 // CHECK:STDOUT: } @@ -55,7 +57,8 @@ fn M() { // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 2, 1, 0 } // CHECK:STDOUT: uselistorder ptr @_CF.Main.0a952f8bcc623ce6, { 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/call_deref_ptr.carbon b/toolchain/lower/testdata/function/generic/call_deref_ptr.carbon index d5b546f77921e..83d77498151d5 100644 --- a/toolchain/lower/testdata/function/generic/call_deref_ptr.carbon +++ b/toolchain/lower/testdata/function/generic/call_deref_ptr.carbon @@ -45,7 +45,8 @@ fn M() { // CHECK:STDOUT: // CHECK:STDOUT: %type = type {} // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CM.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CM.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ptr_i32.var = alloca ptr, align 8, !dbg !7 // CHECK:STDOUT: %ptr_f64.var = alloca ptr, align 8, !dbg !8 @@ -59,28 +60,32 @@ fn M() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Main.d756e33fa3337243(ptr %x) !dbg !14 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Main.d756e33fa3337243(ptr %x) #0 !dbg !14 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %A.call = call %type @_CA.Main.402deed6b8733082(%type zeroinitializer), !dbg !15 // CHECK:STDOUT: call void @_CB.Main.d756e33fa3337243(ptr %x), !dbg !16 // CHECK:STDOUT: ret void, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Main.6765264419ed942e(ptr %x) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Main.6765264419ed942e(ptr %x) #0 !dbg !18 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %A.call = call %type @_CA.Main.402deed6b8733082(%type zeroinitializer), !dbg !19 // CHECK:STDOUT: call void @_CB.Main.6765264419ed942e(ptr %x), !dbg !20 // CHECK:STDOUT: ret void, !dbg !21 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr %type @_CA.Main.402deed6b8733082(%type %x) !dbg !22 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr %type @_CA.Main.402deed6b8733082(%type %x) #0 !dbg !22 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret %type %x, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CB.Main.d756e33fa3337243(ptr %x) !dbg !24 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CB.Main.d756e33fa3337243(ptr %x) #0 !dbg !24 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc27_7.3.temp = alloca i32, align 4, !dbg !25 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc27_7.3.temp), !dbg !25 @@ -90,7 +95,8 @@ fn M() { // CHECK:STDOUT: ret void, !dbg !27 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CB.Main.6765264419ed942e(ptr %x) !dbg !28 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CB.Main.6765264419ed942e(ptr %x) #0 !dbg !28 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc27_7.3.temp = alloca double, align 8, !dbg !29 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc27_7.3.temp), !dbg !29 @@ -100,12 +106,14 @@ fn M() { // CHECK:STDOUT: ret void, !dbg !31 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CD.Main.5450dc8e8b8e0899(i32 %x) !dbg !32 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CD.Main.5450dc8e8b8e0899(i32 %x) #0 !dbg !32 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 %x, !dbg !33 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CD.Main.83aece103b0a8681(double %x) !dbg !34 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CD.Main.83aece103b0a8681(double %x) #0 !dbg !34 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret double %x, !dbg !35 // CHECK:STDOUT: } @@ -114,7 +122,8 @@ fn M() { // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 0, 1, 3, 2 } // CHECK:STDOUT: uselistorder ptr @_CA.Main.402deed6b8733082, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/call_different_associated_const.carbon b/toolchain/lower/testdata/function/generic/call_different_associated_const.carbon index 4d3f6bebb8925..574d118442eda 100644 --- a/toolchain/lower/testdata/function/generic/call_different_associated_const.carbon +++ b/toolchain/lower/testdata/function/generic/call_different_associated_const.carbon @@ -40,14 +40,16 @@ fn H() { // CHECK:STDOUT: ; ModuleID = 'call_different_associated_const.carbon' // CHECK:STDOUT: source_filename = "call_different_associated_const.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CH.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CH.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CG.Main.8e09687ead920c1c(), !dbg !7 // CHECK:STDOUT: call void @_CG.Main.8e09687ead920c1c(), !dbg !8 // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CG.Main.8e09687ead920c1c() !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CG.Main.8e09687ead920c1c() #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca ptr, align 8, !dbg !11 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %x.var), !dbg !11 @@ -55,12 +57,13 @@ fn H() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @_CG.Main.8e09687ead920c1c, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/call_different_impls.carbon b/toolchain/lower/testdata/function/generic/call_different_impls.carbon index 6e191cc611038..6fc8026b8ce72 100644 --- a/toolchain/lower/testdata/function/generic/call_different_impls.carbon +++ b/toolchain/lower/testdata/function/generic/call_different_impls.carbon @@ -38,19 +38,22 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: @printf.int.format = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_CF.X.Main:I.Main"() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_CF.X.Main:I.Main"() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Print.call = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 1), !dbg !7 // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_CF.Y.Main:I.Main"() !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_CF.Y.Main:I.Main"() #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Print.call = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 2), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @main() !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @main() #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CG.Main.4d3c36eeac175c1f(), !dbg !13 // CHECK:STDOUT: call void @_CG.Main.7abe23e63361d139(), !dbg !14 @@ -59,13 +62,15 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: declare i32 @printf(ptr, ...) // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CG.Main.4d3c36eeac175c1f() !dbg !16 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CG.Main.4d3c36eeac175c1f() #0 !dbg !16 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @"_CF.X.Main:I.Main"(), !dbg !17 // CHECK:STDOUT: ret void, !dbg !18 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CG.Main.7abe23e63361d139() !dbg !19 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CG.Main.7abe23e63361d139() #0 !dbg !19 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @"_CF.Y.Main:I.Main"(), !dbg !20 // CHECK:STDOUT: ret void, !dbg !21 @@ -74,6 +79,8 @@ fn Run() { // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @printf, { 1, 0 } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call_different_impls_with_const.carbon b/toolchain/lower/testdata/function/generic/call_different_impls_with_const.carbon index 62b5905f1d175..3607711efc81a 100644 --- a/toolchain/lower/testdata/function/generic/call_different_impls_with_const.carbon +++ b/toolchain/lower/testdata/function/generic/call_different_impls_with_const.carbon @@ -47,19 +47,22 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: @printf.int.format = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @"_CF.X.Main:I.Main"() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @"_CF.X.Main:I.Main"() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Print.call = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 1), !dbg !7 // CHECK:STDOUT: ret i1 false, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @"_CF.Y.Main:I.Main"() !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @"_CF.Y.Main:I.Main"() #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Print.call = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 2), !dbg !10 // CHECK:STDOUT: ret i32 2, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @main() !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @main() #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CG.Main.903f115cc96ac8da(), !dbg !13 // CHECK:STDOUT: call void @_CG.Main.34c09acedc4a7473(), !dbg !14 @@ -68,7 +71,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: declare i32 @printf(ptr, ...) // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CG.Main.903f115cc96ac8da() !dbg !16 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CG.Main.903f115cc96ac8da() #0 !dbg !16 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc37_20.1.temp = alloca i1, align 1, !dbg !17 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc37_20.1.temp), !dbg !17 @@ -80,7 +84,8 @@ fn Run() { // CHECK:STDOUT: ret void, !dbg !18 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CG.Main.34c09acedc4a7473() !dbg !19 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CG.Main.34c09acedc4a7473() #0 !dbg !19 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc37_20.1.temp = alloca i32, align 4, !dbg !20 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc37_20.1.temp), !dbg !20 @@ -91,13 +96,14 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @printf, { 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/call_different_specific.carbon b/toolchain/lower/testdata/function/generic/call_different_specific.carbon index 406c6d77ff686..632b40e18f185 100644 --- a/toolchain/lower/testdata/function/generic/call_different_specific.carbon +++ b/toolchain/lower/testdata/function/generic/call_different_specific.carbon @@ -52,7 +52,8 @@ fn M() { // CHECK:STDOUT: // CHECK:STDOUT: %type = type {} // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CM.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CM.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ptr_i32.var = alloca ptr, align 8, !dbg !7 // CHECK:STDOUT: %ptr_f64.var = alloca ptr, align 8, !dbg !8 @@ -66,28 +67,32 @@ fn M() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Main.d756e33fa3337243(ptr %x) !dbg !14 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Main.d756e33fa3337243(ptr %x) #0 !dbg !14 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %A.call = call %type @_CA.Main.402deed6b8733082(%type zeroinitializer), !dbg !15 // CHECK:STDOUT: call void @_CB.Main.d756e33fa3337243(ptr %x), !dbg !16 // CHECK:STDOUT: ret void, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Main.6765264419ed942e(ptr %x) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Main.6765264419ed942e(ptr %x) #0 !dbg !18 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %A.call = call %type @_CA.Main.402deed6b8733082(%type zeroinitializer), !dbg !19 // CHECK:STDOUT: call void @_CB.Main.6765264419ed942e(ptr %x), !dbg !20 // CHECK:STDOUT: ret void, !dbg !21 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr %type @_CA.Main.402deed6b8733082(%type %x) !dbg !22 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr %type @_CA.Main.402deed6b8733082(%type %x) #0 !dbg !22 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret %type %x, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CB.Main.d756e33fa3337243(ptr %x) !dbg !24 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CB.Main.d756e33fa3337243(ptr %x) #0 !dbg !24 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc34_7.3.temp = alloca i32, align 4, !dbg !25 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc34_7.3.temp), !dbg !25 @@ -97,7 +102,8 @@ fn M() { // CHECK:STDOUT: ret void, !dbg !27 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CB.Main.6765264419ed942e(ptr %x) !dbg !28 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CB.Main.6765264419ed942e(ptr %x) #0 !dbg !28 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc34_7.3.temp = alloca double, align 8, !dbg !29 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc34_7.3.temp), !dbg !29 @@ -107,12 +113,14 @@ fn M() { // CHECK:STDOUT: ret void, !dbg !31 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CD.Main.5450dc8e8b8e0899(i32 %x) !dbg !32 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CD.Main.5450dc8e8b8e0899(i32 %x) #0 !dbg !32 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 %x, !dbg !33 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CD.Main.83aece103b0a8681(double %x) !dbg !34 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CD.Main.83aece103b0a8681(double %x) #0 !dbg !34 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret double %x, !dbg !35 // CHECK:STDOUT: } @@ -121,7 +129,8 @@ fn M() { // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 0, 1, 3, 2 } // CHECK:STDOUT: uselistorder ptr @_CA.Main.402deed6b8733082, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/call_impl_function.carbon b/toolchain/lower/testdata/function/generic/call_impl_function.carbon index 2bb0d1c2a3e06..5f02db383d2ff 100644 --- a/toolchain/lower/testdata/function/generic/call_impl_function.carbon +++ b/toolchain/lower/testdata/function/generic/call_impl_function.carbon @@ -46,24 +46,29 @@ fn G() { // CHECK:STDOUT: ; ModuleID = 'call_impl_function.carbon' // CHECK:STDOUT: source_filename = "call_impl_function.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @"_CF.ImplsSomeInterface.Main:SomeInterface.Main"(i32 %x) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @"_CF.ImplsSomeInterface.Main:SomeInterface.Main"(i32 %x) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.Negate.impl.Op.call = sub i32 0, %x, !dbg !7 // CHECK:STDOUT: ret i32 %Int.as.Negate.impl.Op.call, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CG.Main() !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CG.Main() #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %CallGenericMethod.call = call i32 @_CCallGenericMethod.Main.dc54e41cb8a9bf68(i32 10), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CCallGenericMethod.Main.dc54e41cb8a9bf68(i32 %x) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CCallGenericMethod.Main.dc54e41cb8a9bf68(i32 %x) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc36_15 = call i32 @"_CF.ImplsSomeInterface.Main:SomeInterface.Main"(i32 %x), !dbg !13 // CHECK:STDOUT: ret i32 %.loc36_15, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call_method.carbon b/toolchain/lower/testdata/function/generic/call_method.carbon index cd885e77b190d..47de55656b0ad 100644 --- a/toolchain/lower/testdata/function/generic/call_method.carbon +++ b/toolchain/lower/testdata/function/generic/call_method.carbon @@ -27,7 +27,8 @@ fn CallF() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: @C.val.loc20_3 = internal constant {} zeroinitializer // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CCallF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CCallF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c.var = alloca {}, align 8, !dbg !7 // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !8 @@ -41,12 +42,13 @@ fn CallF() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CF.C.Main.5450dc8e8b8e0899(ptr %self, i32 %x) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CF.C.Main.5450dc8e8b8e0899(ptr %self, i32 %x) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 %x, !dbg !13 // CHECK:STDOUT: } @@ -54,8 +56,9 @@ fn CallF() -> i32 { // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/call_recursive_basic.carbon b/toolchain/lower/testdata/function/generic/call_recursive_basic.carbon index 1fce69020cdb4..0aafb330964ca 100644 --- a/toolchain/lower/testdata/function/generic/call_recursive_basic.carbon +++ b/toolchain/lower/testdata/function/generic/call_recursive_basic.carbon @@ -45,13 +45,15 @@ fn M() { // CHECK:STDOUT: // CHECK:STDOUT: @C.val.loc15_44 = internal constant {} zeroinitializer // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_COp.C.Main:Copy.Core"(ptr sret({}) %return, ptr %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_COp.C.Main:Copy.Core"(ptr sret({}) %return, ptr %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %return, ptr align 1 @C.val.loc15_44, i64 0, i1 false), !dbg !7 // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CM.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CM.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !9 // CHECK:STDOUT: %m.var = alloca double, align 8, !dbg !10 @@ -80,12 +82,13 @@ fn M() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.5450dc8e8b8e0899(i32 %x, i32 %count) !dbg !24 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.5450dc8e8b8e0899(i32 %x, i32 %count) #0 !dbg !24 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 0, !dbg !25 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !26 @@ -99,7 +102,8 @@ fn M() { // CHECK:STDOUT: ret i32 %F.call, !dbg !30 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CF.Main.83aece103b0a8681(double %x, i32 %count) !dbg !31 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CF.Main.83aece103b0a8681(double %x, i32 %count) #0 !dbg !31 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 0, !dbg !32 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !33 @@ -113,7 +117,8 @@ fn M() { // CHECK:STDOUT: ret double %F.call, !dbg !37 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CF.Main.0a952f8bcc623ce6(ptr %x, i32 %count) !dbg !38 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CF.Main.0a952f8bcc623ce6(ptr %x, i32 %count) #0 !dbg !38 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 0, !dbg !39 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !40 @@ -127,7 +132,8 @@ fn M() { // CHECK:STDOUT: ret ptr %F.call, !dbg !44 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Main.936d996ea935415c(ptr sret({}) %return, ptr %x, i32 %count) !dbg !45 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Main.936d996ea935415c(ptr sret({}) %return, ptr %x, i32 %count) #0 !dbg !45 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 0, !dbg !46 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !47 @@ -146,8 +152,9 @@ fn M() { // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 5, 4, 3, 2, 1, 0 } // CHECK:STDOUT: uselistorder ptr @_CF.Main.0a952f8bcc623ce6, { 1, 2, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/call_recursive_diamond.carbon b/toolchain/lower/testdata/function/generic/call_recursive_diamond.carbon index 0ae97ea1de76e..be388281fb8cf 100644 --- a/toolchain/lower/testdata/function/generic/call_recursive_diamond.carbon +++ b/toolchain/lower/testdata/function/generic/call_recursive_diamond.carbon @@ -61,7 +61,8 @@ fn M() { // CHECK:STDOUT: // CHECK:STDOUT: @printf.int.format = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CM.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CM.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !7 // CHECK:STDOUT: %m.var = alloca double, align 8, !dbg !8 @@ -85,9 +86,10 @@ fn M() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CA.Main.5450dc8e8b8e0899(i32 %x, i32 %count) !dbg !20 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CA.Main.5450dc8e8b8e0899(i32 %x, i32 %count) #0 !dbg !20 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 4, !dbg !21 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then.loc22, label %if.else.loc22, !dbg !22 @@ -109,7 +111,8 @@ fn M() { // CHECK:STDOUT: ret i32 %C.call, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CA.Main.83aece103b0a8681(double %x, i32 %count) !dbg !30 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CA.Main.83aece103b0a8681(double %x, i32 %count) #0 !dbg !30 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 4, !dbg !31 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then.loc22, label %if.else.loc22, !dbg !32 @@ -131,7 +134,8 @@ fn M() { // CHECK:STDOUT: ret double %C.call, !dbg !39 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CA.Main.0a952f8bcc623ce6(ptr %x, i32 %count) !dbg !40 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CA.Main.0a952f8bcc623ce6(ptr %x, i32 %count) #0 !dbg !40 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 4, !dbg !41 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then.loc22, label %if.else.loc22, !dbg !42 @@ -153,42 +157,48 @@ fn M() { // CHECK:STDOUT: ret ptr %C.call, !dbg !49 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CB.Main.5450dc8e8b8e0899(i32 %x, i32 %count) !dbg !50 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CB.Main.5450dc8e8b8e0899(i32 %x, i32 %count) #0 !dbg !50 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Print.call = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 1), !dbg !51 // CHECK:STDOUT: %D.call = call i32 @_CD.Main.5450dc8e8b8e0899(i32 %x, i32 %count), !dbg !52 // CHECK:STDOUT: ret i32 %D.call, !dbg !53 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CC.Main.5450dc8e8b8e0899(i32 %x, i32 %count) !dbg !54 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CC.Main.5450dc8e8b8e0899(i32 %x, i32 %count) #0 !dbg !54 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Print.call = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 2), !dbg !55 // CHECK:STDOUT: %D.call = call i32 @_CD.Main.5450dc8e8b8e0899(i32 %x, i32 %count), !dbg !56 // CHECK:STDOUT: ret i32 %D.call, !dbg !57 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CB.Main.83aece103b0a8681(double %x, i32 %count) !dbg !58 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CB.Main.83aece103b0a8681(double %x, i32 %count) #0 !dbg !58 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Print.call = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 1), !dbg !59 // CHECK:STDOUT: %D.call = call double @_CD.Main.83aece103b0a8681(double %x, i32 %count), !dbg !60 // CHECK:STDOUT: ret double %D.call, !dbg !61 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CC.Main.83aece103b0a8681(double %x, i32 %count) !dbg !62 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CC.Main.83aece103b0a8681(double %x, i32 %count) #0 !dbg !62 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Print.call = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 2), !dbg !63 // CHECK:STDOUT: %D.call = call double @_CD.Main.83aece103b0a8681(double %x, i32 %count), !dbg !64 // CHECK:STDOUT: ret double %D.call, !dbg !65 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CB.Main.0a952f8bcc623ce6(ptr %x, i32 %count) !dbg !66 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CB.Main.0a952f8bcc623ce6(ptr %x, i32 %count) #0 !dbg !66 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Print.call = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 1), !dbg !67 // CHECK:STDOUT: %D.call = call ptr @_CD.Main.0a952f8bcc623ce6(ptr %x, i32 %count), !dbg !68 // CHECK:STDOUT: ret ptr %D.call, !dbg !69 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CC.Main.0a952f8bcc623ce6(ptr %x, i32 %count) !dbg !70 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CC.Main.0a952f8bcc623ce6(ptr %x, i32 %count) #0 !dbg !70 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Print.call = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 2), !dbg !71 // CHECK:STDOUT: %D.call = call ptr @_CD.Main.0a952f8bcc623ce6(ptr %x, i32 %count), !dbg !72 @@ -197,21 +207,24 @@ fn M() { // CHECK:STDOUT: // CHECK:STDOUT: declare i32 @printf(ptr, ...) // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CD.Main.5450dc8e8b8e0899(i32 %x, i32 %count) !dbg !74 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CD.Main.5450dc8e8b8e0899(i32 %x, i32 %count) #0 !dbg !74 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.AddWith.impl.Op.call = add i32 %count, 1, !dbg !75 // CHECK:STDOUT: %A.call = call i32 @_CA.Main.5450dc8e8b8e0899(i32 %x, i32 %Int.as.AddWith.impl.Op.call), !dbg !76 // CHECK:STDOUT: ret i32 %A.call, !dbg !77 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CD.Main.83aece103b0a8681(double %x, i32 %count) !dbg !78 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CD.Main.83aece103b0a8681(double %x, i32 %count) #0 !dbg !78 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.AddWith.impl.Op.call = add i32 %count, 1, !dbg !79 // CHECK:STDOUT: %A.call = call double @_CA.Main.83aece103b0a8681(double %x, i32 %Int.as.AddWith.impl.Op.call), !dbg !80 // CHECK:STDOUT: ret double %A.call, !dbg !81 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CD.Main.0a952f8bcc623ce6(ptr %x, i32 %count) !dbg !82 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CD.Main.0a952f8bcc623ce6(ptr %x, i32 %count) #0 !dbg !82 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.AddWith.impl.Op.call = add i32 %count, 1, !dbg !83 // CHECK:STDOUT: %A.call = call ptr @_CA.Main.0a952f8bcc623ce6(ptr %x, i32 %Int.as.AddWith.impl.Op.call), !dbg !84 @@ -226,7 +239,8 @@ fn M() { // CHECK:STDOUT: uselistorder ptr @_CD.Main.83aece103b0a8681, { 1, 0 } // CHECK:STDOUT: uselistorder ptr @_CD.Main.0a952f8bcc623ce6, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/call_recursive_impl.carbon b/toolchain/lower/testdata/function/generic/call_recursive_impl.carbon index abfb7f2d9999c..d42ee32b229eb 100644 --- a/toolchain/lower/testdata/function/generic/call_recursive_impl.carbon +++ b/toolchain/lower/testdata/function/generic/call_recursive_impl.carbon @@ -46,19 +46,22 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: @printf.int.format = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_CF.X.Main:I.Main"() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_CF.X.Main:I.Main"() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Print.call = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 1), !dbg !7 // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_CF.Y.Main:I.Main"() !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_CF.Y.Main:I.Main"() #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Print.call = call i32 (ptr, ...) @printf(ptr @printf.int.format, i32 2), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @main() !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @main() #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %G.call.loc40 = call i32 @_CG.Main.4d3c36eeac175c1f(i32 0), !dbg !13 // CHECK:STDOUT: %G.call.loc41 = call i32 @_CG.Main.7abe23e63361d139(i32 0), !dbg !14 @@ -67,7 +70,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: declare i32 @printf(ptr, ...) // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CG.Main.4d3c36eeac175c1f(i32 %count) !dbg !16 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CG.Main.4d3c36eeac175c1f(i32 %count) #0 !dbg !16 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @"_CF.X.Main:I.Main"(), !dbg !17 // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 0, !dbg !18 @@ -82,7 +86,8 @@ fn Run() { // CHECK:STDOUT: ret i32 %G.call, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CG.Main.7abe23e63361d139(i32 %count) !dbg !24 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CG.Main.7abe23e63361d139(i32 %count) #0 !dbg !24 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @"_CF.Y.Main:I.Main"(), !dbg !25 // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 0, !dbg !26 @@ -100,6 +105,8 @@ fn Run() { // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @printf, { 1, 0 } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/call_recursive_mutual.carbon b/toolchain/lower/testdata/function/generic/call_recursive_mutual.carbon index d47bf0c6f78a2..7a45951bd503a 100644 --- a/toolchain/lower/testdata/function/generic/call_recursive_mutual.carbon +++ b/toolchain/lower/testdata/function/generic/call_recursive_mutual.carbon @@ -44,7 +44,8 @@ fn M() { // CHECK:STDOUT: ; ModuleID = 'call_recursive_mutual.carbon' // CHECK:STDOUT: source_filename = "call_recursive_mutual.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CM.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CM.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !7 // CHECK:STDOUT: %m.var = alloca double, align 8, !dbg !8 @@ -68,9 +69,10 @@ fn M() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.5450dc8e8b8e0899(i32 %x, i32 %count) !dbg !20 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.5450dc8e8b8e0899(i32 %x, i32 %count) #0 !dbg !20 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 3, !dbg !21 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !22 @@ -84,7 +86,8 @@ fn M() { // CHECK:STDOUT: ret i32 %G.call, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CF.Main.83aece103b0a8681(double %x, i32 %count) !dbg !27 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CF.Main.83aece103b0a8681(double %x, i32 %count) #0 !dbg !27 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 3, !dbg !28 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !29 @@ -98,7 +101,8 @@ fn M() { // CHECK:STDOUT: ret double %G.call, !dbg !33 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CF.Main.0a952f8bcc623ce6(ptr %x, i32 %count) !dbg !34 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CF.Main.0a952f8bcc623ce6(ptr %x, i32 %count) #0 !dbg !34 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 3, !dbg !35 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !36 @@ -112,7 +116,8 @@ fn M() { // CHECK:STDOUT: ret ptr %G.call, !dbg !40 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CG.Main.5450dc8e8b8e0899(i32 %x, i32 %count) !dbg !41 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CG.Main.5450dc8e8b8e0899(i32 %x, i32 %count) #0 !dbg !41 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 4, !dbg !42 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !43 @@ -126,7 +131,8 @@ fn M() { // CHECK:STDOUT: ret i32 %F.call, !dbg !47 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CG.Main.83aece103b0a8681(double %x, i32 %count) !dbg !48 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CG.Main.83aece103b0a8681(double %x, i32 %count) #0 !dbg !48 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 4, !dbg !49 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !50 @@ -140,7 +146,8 @@ fn M() { // CHECK:STDOUT: ret double %F.call, !dbg !54 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CG.Main.0a952f8bcc623ce6(ptr %x, i32 %count) !dbg !55 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CG.Main.0a952f8bcc623ce6(ptr %x, i32 %count) #0 !dbg !55 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 4, !dbg !56 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !57 @@ -158,7 +165,8 @@ fn M() { // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 3, 2, 1, 0 } // CHECK:STDOUT: uselistorder ptr @_CF.Main.0a952f8bcc623ce6, { 1, 2, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/call_recursive_reorder.carbon b/toolchain/lower/testdata/function/generic/call_recursive_reorder.carbon index ee8c1d20e8688..6545202cb6c2d 100644 --- a/toolchain/lower/testdata/function/generic/call_recursive_reorder.carbon +++ b/toolchain/lower/testdata/function/generic/call_recursive_reorder.carbon @@ -31,7 +31,8 @@ fn M() { // CHECK:STDOUT: ; ModuleID = 'call_recursive_reorder.carbon' // CHECK:STDOUT: source_filename = "call_recursive_reorder.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CM.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CM.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ptr_i32.var = alloca ptr, align 8, !dbg !7 // CHECK:STDOUT: %ptr_f64.var = alloca ptr, align 8, !dbg !8 @@ -49,9 +50,10 @@ fn M() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.2fe87eb83f5a4614(ptr %x, ptr %y, i32 %count) !dbg !17 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.2fe87eb83f5a4614(ptr %x, ptr %y, i32 %count) #0 !dbg !17 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 2, !dbg !18 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !19 @@ -69,7 +71,8 @@ fn M() { // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 2, 1, 0 } // CHECK:STDOUT: uselistorder ptr @_CF.Main.2fe87eb83f5a4614, { 0, 2, 1 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/call_recursive_reorder_more.carbon b/toolchain/lower/testdata/function/generic/call_recursive_reorder_more.carbon index 05d98eb9a9b17..e23967256415b 100644 --- a/toolchain/lower/testdata/function/generic/call_recursive_reorder_more.carbon +++ b/toolchain/lower/testdata/function/generic/call_recursive_reorder_more.carbon @@ -55,7 +55,8 @@ fn M() { // CHECK:STDOUT: ; ModuleID = 'call_recursive_reorder_more.carbon' // CHECK:STDOUT: source_filename = "call_recursive_reorder_more.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CM.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CM.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %val_i16.var = alloca i16, align 2, !dbg !7 // CHECK:STDOUT: %val_i32.var = alloca i32, align 4, !dbg !8 @@ -129,9 +130,10 @@ fn M() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.077d2bb2ab5eee86(i16 %x, ptr %y, ptr %z, i32 %count) !dbg !65 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.077d2bb2ab5eee86(i16 %x, ptr %y, ptr %z, i32 %count) #0 !dbg !65 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 2, !dbg !66 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !67 @@ -145,7 +147,8 @@ fn M() { // CHECK:STDOUT: ret i32 %F.call, !dbg !71 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.9a89ac9e10448feb(i32 %x, ptr %y, ptr %z, i32 %count) !dbg !72 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.9a89ac9e10448feb(i32 %x, ptr %y, ptr %z, i32 %count) #0 !dbg !72 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 2, !dbg !73 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !74 @@ -159,7 +162,8 @@ fn M() { // CHECK:STDOUT: ret i32 %F.call, !dbg !78 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.76a945443862cc1f(i1 %x, ptr %y, ptr %z, i32 %count) !dbg !79 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.76a945443862cc1f(i1 %x, ptr %y, ptr %z, i32 %count) #0 !dbg !79 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 2, !dbg !80 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !81 @@ -173,7 +177,8 @@ fn M() { // CHECK:STDOUT: ret i32 %F.call, !dbg !85 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.02da1a7614ea56b6(i64 %x, i1 %y, ptr %z, i32 %count) !dbg !86 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.02da1a7614ea56b6(i64 %x, i1 %y, ptr %z, i32 %count) #0 !dbg !86 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 2, !dbg !87 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !88 @@ -187,7 +192,8 @@ fn M() { // CHECK:STDOUT: ret i32 %F.call, !dbg !92 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.4dcab66ec095dfec(double %x, ptr %y, ptr %z, i32 %count) !dbg !93 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.4dcab66ec095dfec(double %x, ptr %y, ptr %z, i32 %count) #0 !dbg !93 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 2, !dbg !94 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !95 @@ -201,7 +207,8 @@ fn M() { // CHECK:STDOUT: ret i32 %F.call, !dbg !99 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.7776e910959584d9(ptr %x, ptr %y, ptr %z, i32 %count) !dbg !100 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.7776e910959584d9(ptr %x, ptr %y, ptr %z, i32 %count) #0 !dbg !100 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 2, !dbg !101 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !102 @@ -215,7 +222,8 @@ fn M() { // CHECK:STDOUT: ret i32 %F.call, !dbg !106 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.bea8bae6e14e4034(i64 %x, ptr %y, i1 %z, i32 %count) !dbg !107 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.bea8bae6e14e4034(i64 %x, ptr %y, i1 %z, i32 %count) #0 !dbg !107 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 2, !dbg !108 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then, label %if.else, !dbg !109 @@ -233,7 +241,8 @@ fn M() { // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 8, 7, 6, 5, 4, 3, 2, 1, 0 } // CHECK:STDOUT: uselistorder ptr @_CF.Main.7776e910959584d9, { 5, 7, 6, 4, 0, 1, 2, 3 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/call_recursive_sccs_deep.carbon b/toolchain/lower/testdata/function/generic/call_recursive_sccs_deep.carbon index cb97e099dd472..40638f801fbc5 100644 --- a/toolchain/lower/testdata/function/generic/call_recursive_sccs_deep.carbon +++ b/toolchain/lower/testdata/function/generic/call_recursive_sccs_deep.carbon @@ -87,7 +87,8 @@ fn M() { // CHECK:STDOUT: // CHECK:STDOUT: @printf.int.format = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CM.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CM.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !7 // CHECK:STDOUT: %m.var = alloca double, align 8, !dbg !8 @@ -111,36 +112,41 @@ fn M() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CA.Main.5450dc8e8b8e0899(i32 %x, i32 %count) !dbg !20 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CA.Main.5450dc8e8b8e0899(i32 %x, i32 %count) #0 !dbg !20 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CB.Main.5450dc8e8b8e0899(i32 %x, i32 %count), !dbg !21 // CHECK:STDOUT: %D.call = call i32 @_CD.Main.5450dc8e8b8e0899(i32 %x, i32 %count), !dbg !22 // CHECK:STDOUT: ret i32 %D.call, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CA.Main.83aece103b0a8681(double %x, i32 %count) !dbg !24 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CA.Main.83aece103b0a8681(double %x, i32 %count) #0 !dbg !24 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CB.Main.83aece103b0a8681(double %x, i32 %count), !dbg !25 // CHECK:STDOUT: %D.call = call double @_CD.Main.83aece103b0a8681(double %x, i32 %count), !dbg !26 // CHECK:STDOUT: ret double %D.call, !dbg !27 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CA.Main.0a952f8bcc623ce6(ptr %x, i32 %count) !dbg !28 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CA.Main.0a952f8bcc623ce6(ptr %x, i32 %count) #0 !dbg !28 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CB.Main.0a952f8bcc623ce6(ptr %x, i32 %count), !dbg !29 // CHECK:STDOUT: %D.call = call ptr @_CD.Main.0a952f8bcc623ce6(ptr %x, i32 %count), !dbg !30 // CHECK:STDOUT: ret ptr %D.call, !dbg !31 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CB.Main.5450dc8e8b8e0899(i32 %x, i32 %count) !dbg !32 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CB.Main.5450dc8e8b8e0899(i32 %x, i32 %count) #0 !dbg !32 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CC.Main.5450dc8e8b8e0899(i32 %x, i32 %count), !dbg !33 // CHECK:STDOUT: ret void, !dbg !34 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CD.Main.5450dc8e8b8e0899(i32 %x, i32 %count) !dbg !35 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CD.Main.5450dc8e8b8e0899(i32 %x, i32 %count) #0 !dbg !35 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 4, !dbg !36 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then.loc48, label %if.else.loc48, !dbg !37 @@ -162,13 +168,15 @@ fn M() { // CHECK:STDOUT: ret i32 %F.call, !dbg !44 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CB.Main.83aece103b0a8681(double %x, i32 %count) !dbg !45 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CB.Main.83aece103b0a8681(double %x, i32 %count) #0 !dbg !45 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CC.Main.83aece103b0a8681(double %x, i32 %count), !dbg !46 // CHECK:STDOUT: ret void, !dbg !47 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CD.Main.83aece103b0a8681(double %x, i32 %count) !dbg !48 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CD.Main.83aece103b0a8681(double %x, i32 %count) #0 !dbg !48 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 4, !dbg !49 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then.loc48, label %if.else.loc48, !dbg !50 @@ -190,13 +198,15 @@ fn M() { // CHECK:STDOUT: ret double %F.call, !dbg !57 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CB.Main.0a952f8bcc623ce6(ptr %x, i32 %count) !dbg !58 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CB.Main.0a952f8bcc623ce6(ptr %x, i32 %count) #0 !dbg !58 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CC.Main.0a952f8bcc623ce6(ptr %x, i32 %count), !dbg !59 // CHECK:STDOUT: ret void, !dbg !60 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CD.Main.0a952f8bcc623ce6(ptr %x, i32 %count) !dbg !61 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CD.Main.0a952f8bcc623ce6(ptr %x, i32 %count) #0 !dbg !61 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.Greater.call = icmp sgt i32 %count, 4, !dbg !62 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.Greater.call, label %if.then.loc48, label %if.else.loc48, !dbg !63 @@ -218,7 +228,8 @@ fn M() { // CHECK:STDOUT: ret ptr %F.call, !dbg !70 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CC.Main.5450dc8e8b8e0899(i32 %x, i32 %count) !dbg !71 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CC.Main.5450dc8e8b8e0899(i32 %x, i32 %count) #0 !dbg !71 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.LessOrEquivalent.call = icmp sle i32 %count, 2, !dbg !72 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.LessOrEquivalent.call, label %if.then, label %if.else, !dbg !73 @@ -233,19 +244,22 @@ fn M() { // CHECK:STDOUT: ret void, !dbg !78 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CE.Main.5450dc8e8b8e0899(i32 %x, i32 %count) !dbg !79 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CE.Main.5450dc8e8b8e0899(i32 %x, i32 %count) #0 !dbg !79 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %G.call = call i32 @_CG.Main.5450dc8e8b8e0899(i32 %x, i32 %count), !dbg !80 // CHECK:STDOUT: ret i32 %G.call, !dbg !81 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.5450dc8e8b8e0899(i32 %x, i32 %count) !dbg !82 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.5450dc8e8b8e0899(i32 %x, i32 %count) #0 !dbg !82 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %G.call = call i32 @_CG.Main.5450dc8e8b8e0899(i32 %x, i32 %count), !dbg !83 // CHECK:STDOUT: ret i32 %G.call, !dbg !84 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CC.Main.83aece103b0a8681(double %x, i32 %count) !dbg !85 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CC.Main.83aece103b0a8681(double %x, i32 %count) #0 !dbg !85 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.LessOrEquivalent.call = icmp sle i32 %count, 2, !dbg !86 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.LessOrEquivalent.call, label %if.then, label %if.else, !dbg !87 @@ -260,19 +274,22 @@ fn M() { // CHECK:STDOUT: ret void, !dbg !92 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CE.Main.83aece103b0a8681(double %x, i32 %count) !dbg !93 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CE.Main.83aece103b0a8681(double %x, i32 %count) #0 !dbg !93 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %G.call = call double @_CG.Main.83aece103b0a8681(double %x, i32 %count), !dbg !94 // CHECK:STDOUT: ret double %G.call, !dbg !95 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CF.Main.83aece103b0a8681(double %x, i32 %count) !dbg !96 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CF.Main.83aece103b0a8681(double %x, i32 %count) #0 !dbg !96 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %G.call = call double @_CG.Main.83aece103b0a8681(double %x, i32 %count), !dbg !97 // CHECK:STDOUT: ret double %G.call, !dbg !98 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CC.Main.0a952f8bcc623ce6(ptr %x, i32 %count) !dbg !99 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CC.Main.0a952f8bcc623ce6(ptr %x, i32 %count) #0 !dbg !99 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.OrderedWith.impl.LessOrEquivalent.call = icmp sle i32 %count, 2, !dbg !100 // CHECK:STDOUT: br i1 %Int.as.OrderedWith.impl.LessOrEquivalent.call, label %if.then, label %if.else, !dbg !101 @@ -287,13 +304,15 @@ fn M() { // CHECK:STDOUT: ret void, !dbg !106 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CE.Main.0a952f8bcc623ce6(ptr %x, i32 %count) !dbg !107 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CE.Main.0a952f8bcc623ce6(ptr %x, i32 %count) #0 !dbg !107 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %G.call = call ptr @_CG.Main.0a952f8bcc623ce6(ptr %x, i32 %count), !dbg !108 // CHECK:STDOUT: ret ptr %G.call, !dbg !109 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CF.Main.0a952f8bcc623ce6(ptr %x, i32 %count) !dbg !110 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CF.Main.0a952f8bcc623ce6(ptr %x, i32 %count) #0 !dbg !110 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %G.call = call ptr @_CG.Main.0a952f8bcc623ce6(ptr %x, i32 %count), !dbg !111 // CHECK:STDOUT: ret ptr %G.call, !dbg !112 @@ -301,21 +320,24 @@ fn M() { // CHECK:STDOUT: // CHECK:STDOUT: declare i32 @printf(ptr, ...) // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CG.Main.5450dc8e8b8e0899(i32 %x, i32 %count) !dbg !113 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CG.Main.5450dc8e8b8e0899(i32 %x, i32 %count) #0 !dbg !113 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.AddWith.impl.Op.call = add i32 %count, 1, !dbg !114 // CHECK:STDOUT: %D.call = call i32 @_CD.Main.5450dc8e8b8e0899(i32 %x, i32 %Int.as.AddWith.impl.Op.call), !dbg !115 // CHECK:STDOUT: ret i32 %D.call, !dbg !116 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CG.Main.83aece103b0a8681(double %x, i32 %count) !dbg !117 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CG.Main.83aece103b0a8681(double %x, i32 %count) #0 !dbg !117 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.AddWith.impl.Op.call = add i32 %count, 1, !dbg !118 // CHECK:STDOUT: %D.call = call double @_CD.Main.83aece103b0a8681(double %x, i32 %Int.as.AddWith.impl.Op.call), !dbg !119 // CHECK:STDOUT: ret double %D.call, !dbg !120 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CG.Main.0a952f8bcc623ce6(ptr %x, i32 %count) !dbg !121 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CG.Main.0a952f8bcc623ce6(ptr %x, i32 %count) #0 !dbg !121 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.AddWith.impl.Op.call = add i32 %count, 1, !dbg !122 // CHECK:STDOUT: %D.call = call ptr @_CD.Main.0a952f8bcc623ce6(ptr %x, i32 %Int.as.AddWith.impl.Op.call), !dbg !123 @@ -330,7 +352,8 @@ fn M() { // CHECK:STDOUT: uselistorder ptr @_CG.Main.83aece103b0a8681, { 1, 0 } // CHECK:STDOUT: uselistorder ptr @_CG.Main.0a952f8bcc623ce6, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/call_specific_in_class.carbon b/toolchain/lower/testdata/function/generic/call_specific_in_class.carbon index 77b0f0f7efc5f..e3b1d1fba3c8d 100644 --- a/toolchain/lower/testdata/function/generic/call_specific_in_class.carbon +++ b/toolchain/lower/testdata/function/generic/call_specific_in_class.carbon @@ -49,7 +49,8 @@ fn M() { // CHECK:STDOUT: // CHECK:STDOUT: %type = type {} // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CM.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CM.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ptr_i32.var = alloca ptr, align 8, !dbg !7 // CHECK:STDOUT: %ptr_f64.var = alloca ptr, align 8, !dbg !8 @@ -80,33 +81,38 @@ fn M() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CF.Main.0a952f8bcc623ce6(ptr %x) !dbg !25 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CF.Main.0a952f8bcc623ce6(ptr %x) #0 !dbg !25 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %G.call = call ptr @_CG.Main.0a952f8bcc623ce6(ptr %x), !dbg !26 // CHECK:STDOUT: ret ptr %G.call, !dbg !27 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.5450dc8e8b8e0899(i32 %x) !dbg !28 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.5450dc8e8b8e0899(i32 %x) #0 !dbg !28 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %G.call = call i32 @_CG.Main.5450dc8e8b8e0899(i32 %x), !dbg !29 // CHECK:STDOUT: ret i32 %G.call, !dbg !30 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CF.Main.83aece103b0a8681(double %x) !dbg !31 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CF.Main.83aece103b0a8681(double %x) #0 !dbg !31 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %G.call = call double @_CG.Main.83aece103b0a8681(double %x), !dbg !32 // CHECK:STDOUT: ret double %G.call, !dbg !33 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr %type @_CF.Main.402deed6b8733082(%type %x) !dbg !34 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr %type @_CF.Main.402deed6b8733082(%type %x) #0 !dbg !34 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %G.call = call %type @_CG.Main.402deed6b8733082(%type %x), !dbg !35 // CHECK:STDOUT: ret %type %G.call, !dbg !36 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CG.Main.0a952f8bcc623ce6(ptr %x) !dbg !37 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CG.Main.0a952f8bcc623ce6(ptr %x) #0 !dbg !37 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c.var = alloca {}, align 8, !dbg !38 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !38 @@ -114,7 +120,8 @@ fn M() { // CHECK:STDOUT: ret ptr %C.Cfn.call, !dbg !40 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CG.Main.5450dc8e8b8e0899(i32 %x) !dbg !41 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CG.Main.5450dc8e8b8e0899(i32 %x) #0 !dbg !41 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c.var = alloca {}, align 8, !dbg !42 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !42 @@ -122,7 +129,8 @@ fn M() { // CHECK:STDOUT: ret i32 %C.Cfn.call, !dbg !44 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CG.Main.83aece103b0a8681(double %x) !dbg !45 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CG.Main.83aece103b0a8681(double %x) #0 !dbg !45 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c.var = alloca {}, align 8, !dbg !46 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !46 @@ -130,7 +138,8 @@ fn M() { // CHECK:STDOUT: ret double %C.Cfn.call, !dbg !48 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr %type @_CG.Main.402deed6b8733082(%type %x) !dbg !49 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr %type @_CG.Main.402deed6b8733082(%type %x) #0 !dbg !49 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c.var = alloca {}, align 8, !dbg !50 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !50 @@ -138,22 +147,26 @@ fn M() { // CHECK:STDOUT: ret %type %C.Cfn.call, !dbg !52 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CCfn.C.Main.0a952f8bcc623ce6(ptr %self, ptr %x) !dbg !53 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CCfn.C.Main.0a952f8bcc623ce6(ptr %self, ptr %x) #0 !dbg !53 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret ptr %x, !dbg !54 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CCfn.C.Main.5450dc8e8b8e0899(ptr %self, i32 %x) !dbg !55 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CCfn.C.Main.5450dc8e8b8e0899(ptr %self, i32 %x) #0 !dbg !55 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 %x, !dbg !56 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr double @_CCfn.C.Main.83aece103b0a8681(ptr %self, double %x) !dbg !57 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr double @_CCfn.C.Main.83aece103b0a8681(ptr %self, double %x) #0 !dbg !57 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret double %x, !dbg !58 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr %type @_CCfn.C.Main.402deed6b8733082(ptr %self, %type %x) !dbg !59 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr %type @_CCfn.C.Main.402deed6b8733082(ptr %self, %type %x) #0 !dbg !59 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret %type %x, !dbg !60 // CHECK:STDOUT: } @@ -162,7 +175,8 @@ fn M() { // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 0, 1, 2, 3, 9, 8, 7, 6, 5, 4 } // CHECK:STDOUT: uselistorder ptr @_CF.Main.0a952f8bcc623ce6, { 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/cross_library_name_collision_private.carbon b/toolchain/lower/testdata/function/generic/cross_library_name_collision_private.carbon index f2591878fdcb0..5ac2fad3627b0 100644 --- a/toolchain/lower/testdata/function/generic/cross_library_name_collision_private.carbon +++ b/toolchain/lower/testdata/function/generic/cross_library_name_collision_private.carbon @@ -74,30 +74,36 @@ fn Run() { // CHECK:STDOUT: ; ModuleID = 'todo_use.carbon' // CHECK:STDOUT: source_filename = "todo_use.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Lib1CallF.call = call i32 @_CLib1CallF.Main.99cfc57c95d4cf0a(i32 1, i32 2), !dbg !7 // CHECK:STDOUT: %Lib2CallF.call = call i32 @_CLib2CallF.Main.99cfc57c95d4cf0a(i32 1, i32 2), !dbg !8 // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CLib1CallF.Main.99cfc57c95d4cf0a(i32 %a, i32 %b) !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CLib1CallF.Main.99cfc57c95d4cf0a(i32 %a, i32 %b) #0 !dbg !10 { // CHECK:STDOUT: %1 = call i32 @_CF.Main.99cfc57c95d4cf0a(i32 %a, i32 %b), !dbg !12 // CHECK:STDOUT: ret i32 %1, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CLib2CallF.Main.99cfc57c95d4cf0a(i32 %a, i32 %b) !dbg !14 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CLib2CallF.Main.99cfc57c95d4cf0a(i32 %a, i32 %b) #0 !dbg !14 { // CHECK:STDOUT: %1 = call i32 @_CF.Main.99cfc57c95d4cf0a(i32 %a, i32 %b), !dbg !16 // CHECK:STDOUT: ret i32 %1, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.99cfc57c95d4cf0a(i32 %a, i32 %b) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.99cfc57c95d4cf0a(i32 %a, i32 %b) #0 !dbg !18 { // CHECK:STDOUT: ret i32 %a, !dbg !19 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @_CF.Main.99cfc57c95d4cf0a, { 1, 0 } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/import.carbon b/toolchain/lower/testdata/function/generic/import.carbon index 59b802db7b4e5..0e4472b079b1b 100644 --- a/toolchain/lower/testdata/function/generic/import.carbon +++ b/toolchain/lower/testdata/function/generic/import.carbon @@ -61,11 +61,14 @@ fn Call() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CIndirectDeclared.Main() // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CIndirectDefined.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CIndirectDefined.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -82,11 +85,14 @@ fn Call() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CDirectDeclared.Main() // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CDirectDefined.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CDirectDefined.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -101,7 +107,8 @@ fn Call() -> i32 { // CHECK:STDOUT: ; ModuleID = 'use.carbon' // CHECK:STDOUT: source_filename = "use.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CCall.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CCall.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !7 // CHECK:STDOUT: %p.var = alloca ptr, align 8, !dbg !8 @@ -116,9 +123,10 @@ fn Call() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CDirectGeneric.Main.b88d1103f417c6d4(ptr %y) !dbg !13 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CDirectGeneric.Main.b88d1103f417c6d4(ptr %y) #0 !dbg !13 { // CHECK:STDOUT: call void @_CDirectDeclared.Main(), !dbg !15 // CHECK:STDOUT: call void @_CDirectDefined.Main(), !dbg !16 // CHECK:STDOUT: %1 = call ptr @_CIndirectGeneric.Main.b88d1103f417c6d4(ptr %y), !dbg !17 @@ -129,7 +137,8 @@ fn Call() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CDirectDefined.Main() // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CIndirectGeneric.Main.b88d1103f417c6d4(ptr %x) !dbg !19 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CIndirectGeneric.Main.b88d1103f417c6d4(ptr %x) #0 !dbg !19 { // CHECK:STDOUT: call void @_CIndirectDeclared.Main(), !dbg !21 // CHECK:STDOUT: call void @_CIndirectDefined.Main(), !dbg !22 // CHECK:STDOUT: ret ptr %x, !dbg !23 @@ -142,7 +151,8 @@ fn Call() -> i32 { // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/reverse_canonical.carbon b/toolchain/lower/testdata/function/generic/reverse_canonical.carbon index 53bd39cb44091..6c8c70f87200a 100644 --- a/toolchain/lower/testdata/function/generic/reverse_canonical.carbon +++ b/toolchain/lower/testdata/function/generic/reverse_canonical.carbon @@ -50,7 +50,8 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'reverse_canonical.carbon' // CHECK:STDOUT: source_filename = "reverse_canonical.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca i1, align 1, !dbg !7 // CHECK:STDOUT: %y.var = alloca ptr, align 8, !dbg !8 @@ -66,9 +67,10 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_Cfirst.Main.36f5e0b0ce09cb9a(i1 %arg1, i1 %arg2, ptr %arg3) !dbg !14 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_Cfirst.Main.36f5e0b0ce09cb9a(i1 %arg1, i1 %arg2, ptr %arg3) #0 !dbg !14 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %local_name.var = alloca ptr, align 8, !dbg !15 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %local_name.var), !dbg !15 @@ -77,7 +79,8 @@ fn Main() { // CHECK:STDOUT: ret void, !dbg !18 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_Csecond.Main.e20e3db21e34eb80(i1 %arg1, i1 %arg2, ptr %arg3) !dbg !19 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_Csecond.Main.e20e3db21e34eb80(i1 %arg1, i1 %arg2, ptr %arg3) #0 !dbg !19 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %local_name.var = alloca ptr, align 8, !dbg !20 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %local_name.var), !dbg !20 @@ -87,7 +90,8 @@ fn Main() { // CHECK:STDOUT: ret void, !dbg !24 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_Cfirst.Main.140560e2430fc2f7(ptr %arg1, ptr %arg2, i1 %arg3) !dbg !25 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_Cfirst.Main.140560e2430fc2f7(ptr %arg1, ptr %arg2, i1 %arg3) #0 !dbg !25 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %local_name.var = alloca ptr, align 8, !dbg !26 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %local_name.var), !dbg !26 @@ -96,7 +100,8 @@ fn Main() { // CHECK:STDOUT: ret void, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_Cthird.Main.e20e3db21e34eb80(i1 %arg1, i1 %arg2, ptr %arg3) !dbg !30 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_Cthird.Main.e20e3db21e34eb80(i1 %arg1, i1 %arg2, ptr %arg3) #0 !dbg !30 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %local_name.var = alloca ptr, align 8, !dbg !31 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %local_name.var), !dbg !31 @@ -107,7 +112,8 @@ fn Main() { // CHECK:STDOUT: ret void, !dbg !36 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_Csecond.Main.f9ad2587bfb58bac(ptr %arg1, ptr %arg2, ptr %arg3) !dbg !37 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_Csecond.Main.f9ad2587bfb58bac(ptr %arg1, ptr %arg2, ptr %arg3) #0 !dbg !37 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %local_name.var = alloca ptr, align 8, !dbg !38 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %local_name.var), !dbg !38 @@ -117,12 +123,14 @@ fn Main() { // CHECK:STDOUT: ret void, !dbg !42 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_Cfourth.Main.9260a3b095cb39ed(ptr %arg1, ptr %arg2, i1 %arg3) !dbg !43 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_Cfourth.Main.9260a3b095cb39ed(ptr %arg1, ptr %arg2, i1 %arg3) #0 !dbg !43 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !44 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_Cfirst.Main.f9ad2587bfb58bac(ptr %arg1, ptr %arg2, ptr %arg3) !dbg !45 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_Cfirst.Main.f9ad2587bfb58bac(ptr %arg1, ptr %arg2, ptr %arg3) #0 !dbg !45 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %local_name.var = alloca ptr, align 8, !dbg !46 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %local_name.var), !dbg !46 @@ -131,7 +139,8 @@ fn Main() { // CHECK:STDOUT: ret void, !dbg !49 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_Cthird.Main.f9ad2587bfb58bac(ptr %arg1, ptr %arg2, ptr %arg3) !dbg !50 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_Cthird.Main.f9ad2587bfb58bac(ptr %arg1, ptr %arg2, ptr %arg3) #0 !dbg !50 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %local_name.var = alloca ptr, align 8, !dbg !51 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %local_name.var), !dbg !51 @@ -142,7 +151,8 @@ fn Main() { // CHECK:STDOUT: ret void, !dbg !56 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_Cfourth.Main.880241312efeb323(ptr %arg1, ptr %arg2, ptr %arg3) !dbg !57 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_Cfourth.Main.880241312efeb323(ptr %arg1, ptr %arg2, ptr %arg3) #0 !dbg !57 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !58 // CHECK:STDOUT: } @@ -152,7 +162,8 @@ fn Main() { // CHECK:STDOUT: uselistorder ptr @_Cfourth.Main.9260a3b095cb39ed, { 1, 0 } // CHECK:STDOUT: uselistorder ptr @_Cfourth.Main.880241312efeb323, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/self_canonical.carbon b/toolchain/lower/testdata/function/generic/self_canonical.carbon index 91af2c51e9075..392d5321818c9 100644 --- a/toolchain/lower/testdata/function/generic/self_canonical.carbon +++ b/toolchain/lower/testdata/function/generic/self_canonical.carbon @@ -85,7 +85,8 @@ fn Main_method_no_template () { // CHECK:STDOUT: ; ModuleID = 'self_canonical.carbon' // CHECK:STDOUT: source_filename = "self_canonical.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain_method_no_template.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain_method_no_template.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %local1.var = alloca ptr, align 8, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %local1.var), !dbg !7 @@ -95,9 +96,10 @@ fn Main_method_no_template () { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_Cfourth_function.Main.a95d5636f2d020e8(ptr %arg) !dbg !11 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_Cfourth_function.Main.a95d5636f2d020e8(ptr %arg) #0 !dbg !11 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %local1.var = alloca ptr, align 8, !dbg !12 // CHECK:STDOUT: %local2.var = alloca ptr, align 8, !dbg !13 @@ -110,7 +112,8 @@ fn Main_method_no_template () { // CHECK:STDOUT: ret void, !dbg !18 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_Cfirst_function.Main.308f7be7cd8574f7(ptr %arg) !dbg !19 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_Cfirst_function.Main.308f7be7cd8574f7(ptr %arg) #0 !dbg !19 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %local1.var = alloca ptr, align 8, !dbg !20 // CHECK:STDOUT: %local2.var = alloca ptr, align 8, !dbg !21 @@ -122,7 +125,8 @@ fn Main_method_no_template () { // CHECK:STDOUT: ret void, !dbg !25 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_Csecond_function.Main.6e67709fb5f3d893(ptr %arg1, ptr %arg2, ptr %arg3) !dbg !26 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_Csecond_function.Main.6e67709fb5f3d893(ptr %arg1, ptr %arg2, ptr %arg3) #0 !dbg !26 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %local1.var = alloca ptr, align 8, !dbg !27 // CHECK:STDOUT: %local2.var = alloca ptr, align 8, !dbg !28 @@ -138,7 +142,8 @@ fn Main_method_no_template () { // CHECK:STDOUT: ret void, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_Cthird_function.Main.bd8cd068af0bdf76(ptr %arg1, ptr %arg2, ptr %arg3) !dbg !36 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_Cthird_function.Main.bd8cd068af0bdf76(ptr %arg1, ptr %arg2, ptr %arg3) #0 !dbg !36 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %local1.var = alloca ptr, align 8, !dbg !37 // CHECK:STDOUT: %local2.var = alloca ptr, align 8, !dbg !38 @@ -154,7 +159,8 @@ fn Main_method_no_template () { // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @_Cfirst_function.Main.308f7be7cd8574f7, { 1, 2, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/function/generic/type_representation.carbon b/toolchain/lower/testdata/function/generic/type_representation.carbon index 8625bdbbd0290..ae64294e4f1c6 100644 --- a/toolchain/lower/testdata/function/generic/type_representation.carbon +++ b/toolchain/lower/testdata/function/generic/type_representation.carbon @@ -77,18 +77,21 @@ fn F_nested_tuple(a: ((i32, i32), X)) -> ((i32, i32), X) { // CHECK:STDOUT: ; ModuleID = 'type_representation.carbon' // CHECK:STDOUT: source_filename = "type_representation.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @"_COp.Int.Core:Copy.Main"(i32 %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @"_COp.Int.Core:Copy.Main"(i32 %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 %self, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CF_i32.Main(i32 %a) !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CF_i32.Main(i32 %a) #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %F.call = call i32 @_CF.Main.cf9485df26e40963(i32 %a), !dbg !9 // CHECK:STDOUT: ret i32 %F.call, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_COp.X.Main:Copy.Main"(ptr sret({ i32, i32 }) %return, ptr %self) !dbg !11 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_COp.X.Main:Copy.Main"(ptr sret({ i32, i32 }) %return, ptr %self) #0 !dbg !11 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc38_24.1.a = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 0, !dbg !12 // CHECK:STDOUT: %.loc38_24.2 = load i32, ptr %.loc38_24.1.a, align 4, !dbg !12 @@ -101,24 +104,28 @@ fn F_nested_tuple(a: ((i32, i32), X)) -> ((i32, i32), X) { // CHECK:STDOUT: ret void, !dbg !15 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF_X.Main(ptr sret({ i32, i32 }) %return, ptr %a) !dbg !16 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF_X.Main(ptr sret({ i32, i32 }) %return, ptr %a) #0 !dbg !16 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CF.Main.731881fd665c07ab(ptr %return, ptr %a), !dbg !17 // CHECK:STDOUT: ret void, !dbg !18 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_COp.61ea2aba74ab3bf1:Copy.Main"() !dbg !19 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_COp.61ea2aba74ab3bf1:Copy.Main"() #0 !dbg !19 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF_empty_tuple.Main() !dbg !21 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF_empty_tuple.Main() #0 !dbg !21 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CF.Main.ac6bb6b581e07691(), !dbg !22 // CHECK:STDOUT: ret void, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_COp.d07e2731f1087d49:Copy.Main"(ptr sret({ i32, i32 }) %return, ptr %self) !dbg !24 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_COp.d07e2731f1087d49:Copy.Main"(ptr sret({ i32, i32 }) %return, ptr %self) #0 !dbg !24 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %tuple.elem0.loc59_12.1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 0, !dbg !25 // CHECK:STDOUT: %tuple.elem0.loc59_12.1.tuple.elem.load = load i32, ptr %tuple.elem0.loc59_12.1.tuple.elem, align 4, !dbg !25 @@ -131,13 +138,15 @@ fn F_nested_tuple(a: ((i32, i32), X)) -> ((i32, i32), X) { // CHECK:STDOUT: ret void, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF_two_tuple.Main(ptr sret({ i32, i32 }) %return, ptr %a) !dbg !27 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF_two_tuple.Main(ptr sret({ i32, i32 }) %return, ptr %a) #0 !dbg !27 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CF.Main.86a4a70fb2978f72(ptr %return, ptr %a), !dbg !28 // CHECK:STDOUT: ret void, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_COp.4af564822fd0c29a:Copy.Main"(ptr sret({ { i32, i32 }, { i32, i32 } }) %return, ptr %self) !dbg !30 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_COp.4af564822fd0c29a:Copy.Main"(ptr sret({ { i32, i32 }, { i32, i32 } }) %return, ptr %self) #0 !dbg !30 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %tuple.elem0.loc69_17.tuple.elem = getelementptr inbounds nuw { ptr, ptr }, ptr %self, i32 0, i32 0, !dbg !31 // CHECK:STDOUT: %tuple.elem0.loc69_17.tuple.elem.load = load ptr, ptr %tuple.elem0.loc69_17.tuple.elem, align 8, !dbg !31 @@ -150,13 +159,15 @@ fn F_nested_tuple(a: ((i32, i32), X)) -> ((i32, i32), X) { // CHECK:STDOUT: ret void, !dbg !34 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF_nested_tuple.Main(ptr sret({ { i32, i32 }, { i32, i32 } }) %return, ptr %a) !dbg !35 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF_nested_tuple.Main(ptr sret({ { i32, i32 }, { i32, i32 } }) %return, ptr %a) #0 !dbg !35 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CF.Main.bfaac0eb7445cea4(ptr %return, ptr %a), !dbg !36 // CHECK:STDOUT: ret void, !dbg !37 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.cf9485df26e40963(i32 %a) !dbg !38 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @_CF.Main.cf9485df26e40963(i32 %a) #0 !dbg !38 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %v.var = alloca i32, align 4, !dbg !39 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %v.var), !dbg !39 @@ -166,7 +177,8 @@ fn F_nested_tuple(a: ((i32, i32), X)) -> ((i32, i32), X) { // CHECK:STDOUT: ret i32 %.loc19, !dbg !42 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Main.731881fd665c07ab(ptr sret({ i32, i32 }) %return, ptr %a) !dbg !43 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Main.731881fd665c07ab(ptr sret({ i32, i32 }) %return, ptr %a) #0 !dbg !43 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %v.var = alloca { i32, i32 }, align 8, !dbg !44 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %v.var), !dbg !44 @@ -175,7 +187,8 @@ fn F_nested_tuple(a: ((i32, i32), X)) -> ((i32, i32), X) { // CHECK:STDOUT: ret void, !dbg !47 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Main.ac6bb6b581e07691() !dbg !48 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Main.ac6bb6b581e07691() #0 !dbg !48 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %v.var = alloca {}, align 8, !dbg !49 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %v.var), !dbg !49 @@ -184,7 +197,8 @@ fn F_nested_tuple(a: ((i32, i32), X)) -> ((i32, i32), X) { // CHECK:STDOUT: ret void, !dbg !52 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Main.86a4a70fb2978f72(ptr sret({ i32, i32 }) %return, ptr %a) !dbg !53 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Main.86a4a70fb2978f72(ptr sret({ i32, i32 }) %return, ptr %a) #0 !dbg !53 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %v.var = alloca { i32, i32 }, align 8, !dbg !54 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %v.var), !dbg !54 @@ -193,7 +207,8 @@ fn F_nested_tuple(a: ((i32, i32), X)) -> ((i32, i32), X) { // CHECK:STDOUT: ret void, !dbg !57 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CF.Main.bfaac0eb7445cea4(ptr sret({ { i32, i32 }, { i32, i32 } }) %return, ptr %a) !dbg !58 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CF.Main.bfaac0eb7445cea4(ptr sret({ { i32, i32 }, { i32, i32 } }) %return, ptr %a) #0 !dbg !58 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %v.var = alloca { { i32, i32 }, { i32, i32 } }, align 8, !dbg !59 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %v.var), !dbg !59 @@ -203,12 +218,13 @@ fn F_nested_tuple(a: ((i32, i32), X)) -> ((i32, i32), X) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/global/class_obj.carbon b/toolchain/lower/testdata/global/class_obj.carbon index 979e2e14d1f51..0d2c2b41f34c2 100644 --- a/toolchain/lower/testdata/global/class_obj.carbon +++ b/toolchain/lower/testdata/global/class_obj.carbon @@ -20,16 +20,18 @@ var a: A = {}; // CHECK:STDOUT: @A.val.loc14_1 = internal constant {} zeroinitializer // CHECK:STDOUT: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @_C__global_init.Main, ptr null }] // CHECK:STDOUT: -// CHECK:STDOUT: define void @_C__global_init.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_C__global_init.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 @_Ca.Main, ptr align 1 @A.val.loc14_1, i64 0, i1 false), !dbg !7 // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/global/class_with_fun.carbon b/toolchain/lower/testdata/global/class_with_fun.carbon index 32d836268f4b1..6f1a084ad3e6b 100644 --- a/toolchain/lower/testdata/global/class_with_fun.carbon +++ b/toolchain/lower/testdata/global/class_with_fun.carbon @@ -24,25 +24,28 @@ var a: A = {}; // CHECK:STDOUT: @A.val.loc15_12 = internal constant {} zeroinitializer // CHECK:STDOUT: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @_C__global_init.Main, ptr null }] // CHECK:STDOUT: -// CHECK:STDOUT: define void @_Cret_a.Main(ptr sret({}) %return) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_Cret_a.Main(ptr sret({}) %return) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %return, ptr align 1 @A.val.loc15_12, i64 0, i1 false), !dbg !7 // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_C__global_init.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_C__global_init.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 @_Ca.Main, ptr align 1 @A.val.loc15_12, i64 0, i1 false), !dbg !9 // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/global/simple_init.carbon b/toolchain/lower/testdata/global/simple_init.carbon index 2d16cfccc8a16..69639a9f1b333 100644 --- a/toolchain/lower/testdata/global/simple_init.carbon +++ b/toolchain/lower/testdata/global/simple_init.carbon @@ -17,12 +17,15 @@ var a: i32 = 0; // CHECK:STDOUT: @_Ca.Main = global i32 0 // CHECK:STDOUT: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @_C__global_init.Main, ptr null }] // CHECK:STDOUT: -// CHECK:STDOUT: define void @_C__global_init.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_C__global_init.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: store i32 0, ptr @_Ca.Main, align 4, !dbg !7 // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/global/simple_with_fun.carbon b/toolchain/lower/testdata/global/simple_with_fun.carbon index fbfe85bc278f2..bade52cf66f08 100644 --- a/toolchain/lower/testdata/global/simple_with_fun.carbon +++ b/toolchain/lower/testdata/global/simple_with_fun.carbon @@ -22,18 +22,22 @@ var a: i32 = test_a(); // CHECK:STDOUT: @_Ca.Main = global i32 0 // CHECK:STDOUT: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @_C__global_init.Main, ptr null }] // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_Ctest_a.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_Ctest_a.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 0, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_C__global_init.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_C__global_init.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %test_a.call = call i32 @_Ctest_a.Main(), !dbg !9 // CHECK:STDOUT: store i32 %test_a.call, ptr @_Ca.Main, align 4, !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/global/use.carbon b/toolchain/lower/testdata/global/use.carbon index 055e7df966810..d3c23d206e564 100644 --- a/toolchain/lower/testdata/global/use.carbon +++ b/toolchain/lower/testdata/global/use.carbon @@ -24,13 +24,15 @@ fn F() -> i32 { // CHECK:STDOUT: @_Cb.Main = global i32 0 // CHECK:STDOUT: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @_C__global_init.Main, ptr null }] // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc17 = load i32, ptr @_Ca.Main, align 4, !dbg !7 // CHECK:STDOUT: ret i32 %.loc17, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_C__global_init.Main() !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_C__global_init.Main() #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: store i32 5, ptr @_Ca.Main, align 4, !dbg !10 // CHECK:STDOUT: %.loc14 = load i32, ptr @_Ca.Main, align 4, !dbg !11 @@ -38,6 +40,8 @@ fn F() -> i32 { // CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/if/else.carbon b/toolchain/lower/testdata/if/else.carbon index 10be6d638358a..e2272bed19ce6 100644 --- a/toolchain/lower/testdata/if/else.carbon +++ b/toolchain/lower/testdata/if/else.carbon @@ -26,22 +26,26 @@ fn If(b: bool) { // CHECK:STDOUT: ; ModuleID = 'else.carbon' // CHECK:STDOUT: source_filename = "else.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CG.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CG.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CH.Main() !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CH.Main() #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CIf.Main(i1 %b) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CIf.Main(i1 %b) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: br i1 %b, label %if.then, label %if.else, !dbg !13 // CHECK:STDOUT: @@ -58,6 +62,8 @@ fn If(b: bool) { // CHECK:STDOUT: ret void, !dbg !18 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/if/no_else.carbon b/toolchain/lower/testdata/if/no_else.carbon index 68a0e6ccf7c19..ef0a64a17e5a1 100644 --- a/toolchain/lower/testdata/if/no_else.carbon +++ b/toolchain/lower/testdata/if/no_else.carbon @@ -23,17 +23,20 @@ fn If(b: bool) { // CHECK:STDOUT: ; ModuleID = 'no_else.carbon' // CHECK:STDOUT: source_filename = "no_else.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CG.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CG.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CIf.Main(i1 %b) !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CIf.Main(i1 %b) #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: br i1 %b, label %if.then, label %if.else, !dbg !11 // CHECK:STDOUT: @@ -46,6 +49,8 @@ fn If(b: bool) { // CHECK:STDOUT: ret void, !dbg !15 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/if_expr/basic.carbon b/toolchain/lower/testdata/if_expr/basic.carbon index ebc4a6f9fda9b..3d1c519592a5a 100644 --- a/toolchain/lower/testdata/if_expr/basic.carbon +++ b/toolchain/lower/testdata/if_expr/basic.carbon @@ -20,17 +20,20 @@ fn Select(b: bool) -> i32 { // CHECK:STDOUT: ; ModuleID = 'basic.carbon' // CHECK:STDOUT: source_filename = "basic.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 1, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CG.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CG.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 2, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CSelect.Main(i1 %b) !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CSelect.Main(i1 %b) #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: br i1 %b, label %if.expr.then, label %if.expr.else, !dbg !11 // CHECK:STDOUT: @@ -47,6 +50,8 @@ fn Select(b: bool) -> i32 { // CHECK:STDOUT: ret i32 %0, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/if_expr/empty_block.carbon b/toolchain/lower/testdata/if_expr/empty_block.carbon index d163e064110fa..134dba9fd7730 100644 --- a/toolchain/lower/testdata/if_expr/empty_block.carbon +++ b/toolchain/lower/testdata/if_expr/empty_block.carbon @@ -17,7 +17,8 @@ fn Select(b: bool, c: bool, d: bool) -> i32 { // CHECK:STDOUT: ; ModuleID = 'empty_block.carbon' // CHECK:STDOUT: source_filename = "empty_block.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CSelect.Main(i1 %b, i1 %c, i1 %d) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CSelect.Main(i1 %b, i1 %c, i1 %d) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: br i1 %b, label %if.expr.then.loc14_10, label %if.expr.else.loc14_10, !dbg !7 // CHECK:STDOUT: @@ -52,6 +53,8 @@ fn Select(b: bool, c: bool, d: bool) -> i32 { // CHECK:STDOUT: ret i32 %2, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/impl/assoc_fn_alias.carbon b/toolchain/lower/testdata/impl/assoc_fn_alias.carbon index ce6e3e63ae567..552492e1484e9 100644 --- a/toolchain/lower/testdata/impl/assoc_fn_alias.carbon +++ b/toolchain/lower/testdata/impl/assoc_fn_alias.carbon @@ -32,19 +32,23 @@ fn Call(a: A) -> i32 { // CHECK:STDOUT: ; ModuleID = 'assoc_fn_alias.carbon' // CHECK:STDOUT: source_filename = "assoc_fn_alias.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @"_CF.A.Main:I.Main"(ptr %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @"_CF.A.Main:I.Main"(ptr %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc24_16.1.n = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %.loc24_16.2 = load i32, ptr %.loc24_16.1.n, align 4, !dbg !7 // CHECK:STDOUT: ret i32 %.loc24_16.2, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CCall.Main(ptr %a) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CCall.Main(ptr %a) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %A.as.I.impl.F.call = call i32 @"_CF.A.Main:I.Main"(ptr %a), !dbg !10 // CHECK:STDOUT: ret i32 %A.as.I.impl.F.call, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/impl/extend_impl.carbon b/toolchain/lower/testdata/impl/extend_impl.carbon index e146ba09712e6..03a338ea588ae 100644 --- a/toolchain/lower/testdata/impl/extend_impl.carbon +++ b/toolchain/lower/testdata/impl/extend_impl.carbon @@ -33,23 +33,28 @@ fn InstanceAccess(a: A) -> i32 { // CHECK:STDOUT: ; ModuleID = 'extend_impl.carbon' // CHECK:STDOUT: source_filename = "extend_impl.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @"_CF.A.Main:I.Main"() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @"_CF.A.Main:I.Main"() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 0, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CTypeAccess.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CTypeAccess.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %A.as.I.impl.F.call = call i32 @"_CF.A.Main:I.Main"(), !dbg !9 // CHECK:STDOUT: ret i32 %A.as.I.impl.F.call, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CInstanceAccess.Main(ptr %a) !dbg !11 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CInstanceAccess.Main(ptr %a) #0 !dbg !11 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %A.as.I.impl.F.call = call i32 @"_CF.A.Main:I.Main"(), !dbg !12 // CHECK:STDOUT: ret i32 %A.as.I.impl.F.call, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/impl/impl.carbon b/toolchain/lower/testdata/impl/impl.carbon index 64a7aa521d372..bc2c86c1b32c3 100644 --- a/toolchain/lower/testdata/impl/impl.carbon +++ b/toolchain/lower/testdata/impl/impl.carbon @@ -31,19 +31,23 @@ fn Call(a: A) -> i32 { // CHECK:STDOUT: ; ModuleID = 'impl.carbon' // CHECK:STDOUT: source_filename = "impl.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @"_CF.A.Main:I.Main"(ptr %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @"_CF.A.Main:I.Main"(ptr %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc23_16.1.n = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %.loc23_16.2 = load i32, ptr %.loc23_16.1.n, align 4, !dbg !7 // CHECK:STDOUT: ret i32 %.loc23_16.2, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CCall.Main(ptr %a) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CCall.Main(ptr %a) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %A.as.I.impl.F.call = call i32 @"_CF.A.Main:I.Main"(ptr %a), !dbg !10 // CHECK:STDOUT: ret i32 %A.as.I.impl.F.call, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/impl/import.carbon b/toolchain/lower/testdata/impl/import.carbon index e0a7ec914a389..1cc35f31bc424 100644 --- a/toolchain/lower/testdata/impl/import.carbon +++ b/toolchain/lower/testdata/impl/import.carbon @@ -39,13 +39,16 @@ fn Call(a: A) -> i32 { // CHECK:STDOUT: ; ModuleID = 'impl_def.carbon' // CHECK:STDOUT: source_filename = "impl_def.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @"_CF.A.Main:I.Main"(ptr %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @"_CF.A.Main:I.Main"(ptr %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc14_16.1.n = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %.loc14_16.2 = load i32, ptr %.loc14_16.1.n, align 4, !dbg !7 // CHECK:STDOUT: ret i32 %.loc14_16.2, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -61,7 +64,8 @@ fn Call(a: A) -> i32 { // CHECK:STDOUT: ; ModuleID = 'impl_use.carbon' // CHECK:STDOUT: source_filename = "impl_use.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CCall.Main(ptr %a) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CCall.Main(ptr %a) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %A.as.I.impl.F.call = call i32 @"_CF.A.Main:I.Main"(ptr %a), !dbg !7 // CHECK:STDOUT: ret i32 %A.as.I.impl.F.call, !dbg !8 @@ -69,6 +73,8 @@ fn Call(a: A) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: declare i32 @"_CF.A.Main:I.Main"(ptr) // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/impl/import_thunk.carbon b/toolchain/lower/testdata/impl/import_thunk.carbon index 0895f5f7b3240..3d784d95071d7 100644 --- a/toolchain/lower/testdata/impl/import_thunk.carbon +++ b/toolchain/lower/testdata/impl/import_thunk.carbon @@ -69,7 +69,8 @@ fn Test(a: A) -> C { // CHECK:STDOUT: ; ModuleID = 'thunk.carbon' // CHECK:STDOUT: source_filename = "thunk.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_CConvert.A.Main:ImplicitAs.Core"(ptr sret({ i32 }) %return, ptr %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_CConvert.A.Main:ImplicitAs.Core"(ptr sret({ i32 }) %return, ptr %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc9_49.1.a = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %.loc9_49.2 = load i32, ptr %.loc9_49.1.a, align 4, !dbg !7 @@ -78,7 +79,8 @@ fn Test(a: A) -> C { // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_CConvert.B.Main:ImplicitAs.Core"(ptr sret({ i32 }) %return, ptr %self) !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_CConvert.B.Main:ImplicitAs.Core"(ptr sret({ i32 }) %return, ptr %self) #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc12_49.1.b = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !11 // CHECK:STDOUT: %.loc12_49.2 = load i32, ptr %.loc12_49.1.b, align 4, !dbg !11 @@ -87,7 +89,8 @@ fn Test(a: A) -> C { // CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_CF.61ea2aba74ab3bf1:I.Main"(ptr sret({ i32 }) %return, ptr %b) !dbg !14 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_CF.61ea2aba74ab3bf1:I.Main"(ptr sret({ i32 }) %return, ptr %b) #0 !dbg !14 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc20_35.1.b = getelementptr inbounds nuw { i32 }, ptr %b, i32 0, i32 0, !dbg !15 // CHECK:STDOUT: %.loc20_35.2 = load i32, ptr %.loc20_35.1.b, align 4, !dbg !15 @@ -96,7 +99,8 @@ fn Test(a: A) -> C { // CHECK:STDOUT: ret void, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_CF:thunk.61ea2aba74ab3bf1:I.Main"(ptr sret({ i32 }) %return, ptr %a) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind +// CHECK:STDOUT: define void @"_CF:thunk.61ea2aba74ab3bf1:I.Main"(ptr sret({ i32 }) %return, ptr %a) #1 !dbg !18 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc20_19.1.temp = alloca { i32 }, align 8, !dbg !19 // CHECK:STDOUT: %.loc16_9.1.temp = alloca { i32 }, align 8, !dbg !20 @@ -111,12 +115,14 @@ fn Test(a: A) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline nounwind } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -145,7 +151,8 @@ fn Test(a: A) -> C { // CHECK:STDOUT: ; ModuleID = 'call_thunk.carbon' // CHECK:STDOUT: source_filename = "call_thunk.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTest.Main(ptr sret({ i32 }) %return, ptr %a) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTest.Main(ptr sret({ i32 }) %return, ptr %a) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7_20.1.temp = alloca { i32 }, align 8, !dbg !7 // CHECK:STDOUT: %.loc7_20.2.temp = alloca { i32 }, align 8, !dbg !7 @@ -170,12 +177,13 @@ fn Test(a: A) -> C { // CHECK:STDOUT: declare void @"_CConvert.B.Main:ImplicitAs.Core"(ptr sret({ i32 }), ptr) // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -193,7 +201,8 @@ fn Test(a: A) -> C { // CHECK:STDOUT: ; ModuleID = 'thunk_for_imported_interface.carbon' // CHECK:STDOUT: source_filename = "thunk_for_imported_interface.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_CF.X.Main:I.Main"(ptr sret({ i32 }) %return, ptr %b) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_CF.X.Main:I.Main"(ptr sret({ i32 }) %return, ptr %b) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc9_35.1.b = getelementptr inbounds nuw { i32 }, ptr %b, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %.loc9_35.2 = load i32, ptr %.loc9_35.1.b, align 4, !dbg !7 @@ -202,7 +211,8 @@ fn Test(a: A) -> C { // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_CF:thunk.X.Main:I.Main"(ptr sret({ i32 }) %return, ptr %a) !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind +// CHECK:STDOUT: define void @"_CF:thunk.X.Main:I.Main"(ptr sret({ i32 }) %return, ptr %a) #1 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc9_19.1.temp = alloca { i32 }, align 8, !dbg !11 // CHECK:STDOUT: %.2.temp = alloca { i32 }, align 8 @@ -221,12 +231,14 @@ fn Test(a: A) -> C { // CHECK:STDOUT: declare void @"_CConvert.B.Main:ImplicitAs.Core"(ptr sret({ i32 }), ptr) // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline nounwind } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -247,7 +259,8 @@ fn Test(a: A) -> C { // CHECK:STDOUT: ; ModuleID = 'call_thunk_for_imported_interface.carbon' // CHECK:STDOUT: source_filename = "call_thunk_for_imported_interface.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTest.Main(ptr sret({ i32 }) %return, ptr %a) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTest.Main(ptr sret({ i32 }) %return, ptr %a) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc8_19.1.temp = alloca { i32 }, align 8, !dbg !7 // CHECK:STDOUT: %.loc8_19.2.temp = alloca { i32 }, align 8, !dbg !7 @@ -272,12 +285,13 @@ fn Test(a: A) -> C { // CHECK:STDOUT: declare void @"_CConvert.B.Main:ImplicitAs.Core"(ptr sret({ i32 }), ptr) // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/impl/instance_method.carbon b/toolchain/lower/testdata/impl/instance_method.carbon index b530b4a171e53..2072b893b2690 100644 --- a/toolchain/lower/testdata/impl/instance_method.carbon +++ b/toolchain/lower/testdata/impl/instance_method.carbon @@ -31,17 +31,21 @@ fn Call(a: A*) -> A* { // CHECK:STDOUT: ; ModuleID = 'instance_method.carbon' // CHECK:STDOUT: source_filename = "instance_method.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define ptr @"_CGet.A.Main:GetSelf.Main"(ptr %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define ptr @"_CGet.A.Main:GetSelf.Main"(ptr %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret ptr %self, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define ptr @_CCall.Main(ptr %a) !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define ptr @_CCall.Main(ptr %a) #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %A.as.GetSelf.impl.Get.call = call ptr @"_CGet.A.Main:GetSelf.Main"(ptr %a), !dbg !9 // CHECK:STDOUT: ret ptr %A.as.GetSelf.impl.Get.call, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/impl/instance_method_addr.carbon b/toolchain/lower/testdata/impl/instance_method_addr.carbon index 502ea56a5e31a..8a865b9403ad4 100644 --- a/toolchain/lower/testdata/impl/instance_method_addr.carbon +++ b/toolchain/lower/testdata/impl/instance_method_addr.carbon @@ -31,17 +31,21 @@ fn Call(a: A*) -> A* { // CHECK:STDOUT: ; ModuleID = 'instance_method_addr.carbon' // CHECK:STDOUT: source_filename = "instance_method_addr.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define ptr @"_CGet.A.Main:GetSelf.Main"(ptr %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define ptr @"_CGet.A.Main:GetSelf.Main"(ptr %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret ptr %self, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define ptr @_CCall.Main(ptr %a) !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define ptr @_CCall.Main(ptr %a) #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %A.as.GetSelf.impl.Get.call = call ptr @"_CGet.A.Main:GetSelf.Main"(ptr %a), !dbg !9 // CHECK:STDOUT: ret ptr %A.as.GetSelf.impl.Get.call, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/impl/thunk.carbon b/toolchain/lower/testdata/impl/thunk.carbon index 204f791d942b8..ecb3065bf63f3 100644 --- a/toolchain/lower/testdata/impl/thunk.carbon +++ b/toolchain/lower/testdata/impl/thunk.carbon @@ -73,7 +73,8 @@ fn CallCallGeneric(c: C(()), b: B) -> A { // CHECK:STDOUT: ; ModuleID = 'thunk.carbon' // CHECK:STDOUT: source_filename = "thunk.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_CConvert.A.Main:ImplicitAs.Core"(ptr sret({ i32 }) %return, ptr %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_CConvert.A.Main:ImplicitAs.Core"(ptr sret({ i32 }) %return, ptr %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc9_49.1.a = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %.loc9_49.2 = load i32, ptr %.loc9_49.1.a, align 4, !dbg !7 @@ -82,7 +83,8 @@ fn CallCallGeneric(c: C(()), b: B) -> A { // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_CConvert.B.Main:ImplicitAs.Core"(ptr sret({ i32 }) %return, ptr %self) !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_CConvert.B.Main:ImplicitAs.Core"(ptr sret({ i32 }) %return, ptr %self) #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc12_49.1.b = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !11 // CHECK:STDOUT: %.loc12_49.2 = load i32, ptr %.loc12_49.1.b, align 4, !dbg !11 @@ -91,7 +93,8 @@ fn CallCallGeneric(c: C(()), b: B) -> A { // CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_CF.61ea2aba74ab3bf1:I.Main"(ptr sret({ i32 }) %return, ptr %b) !dbg !14 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_CF.61ea2aba74ab3bf1:I.Main"(ptr sret({ i32 }) %return, ptr %b) #0 !dbg !14 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc20_35.1.b = getelementptr inbounds nuw { i32 }, ptr %b, i32 0, i32 0, !dbg !15 // CHECK:STDOUT: %.loc20_35.2 = load i32, ptr %.loc20_35.1.b, align 4, !dbg !15 @@ -100,7 +103,8 @@ fn CallCallGeneric(c: C(()), b: B) -> A { // CHECK:STDOUT: ret void, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_CF:thunk.61ea2aba74ab3bf1:I.Main"(ptr sret({ i32 }) %return, ptr %a) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind +// CHECK:STDOUT: define void @"_CF:thunk.61ea2aba74ab3bf1:I.Main"(ptr sret({ i32 }) %return, ptr %a) #1 !dbg !18 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc20_19.1.temp = alloca { i32 }, align 8, !dbg !19 // CHECK:STDOUT: %.loc16_9.1.temp = alloca { i32 }, align 8, !dbg !20 @@ -114,7 +118,8 @@ fn CallCallGeneric(c: C(()), b: B) -> A { // CHECK:STDOUT: ret void, !dbg !19 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTest.Main(ptr sret({ i32 }) %return, ptr %a) !dbg !21 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTest.Main(ptr sret({ i32 }) %return, ptr %a) #0 !dbg !21 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc24_20.1.temp = alloca { i32 }, align 8, !dbg !22 // CHECK:STDOUT: %.loc24_20.2.temp = alloca { i32 }, align 8, !dbg !22 @@ -131,12 +136,14 @@ fn CallCallGeneric(c: C(()), b: B) -> A { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 6, 5, 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline nounwind } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -172,13 +179,15 @@ fn CallCallGeneric(c: C(()), b: B) -> A { // CHECK:STDOUT: @A.val.loc7_46 = internal constant {} zeroinitializer // CHECK:STDOUT: @B.val.loc18_42 = internal constant {} zeroinitializer // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_CConvert.B.Main:ImplicitAs.Core"(ptr sret({}) %return, ptr %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_CConvert.B.Main:ImplicitAs.Core"(ptr sret({}) %return, ptr %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %return, ptr align 1 @A.val.loc7_46, i64 0, i1 false), !dbg !7 // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CCall.Main(ptr sret({}) %return, ptr %c, ptr %b) !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CCall.Main(ptr sret({}) %return, ptr %c, ptr %b) #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc22_23.1.temp = alloca {}, align 8, !dbg !9 // CHECK:STDOUT: %.loc22_23.3.temp = alloca {}, align 8, !dbg !9 @@ -197,31 +206,35 @@ fn CallCallGeneric(c: C(()), b: B) -> A { // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CCallCallGeneric.Main(ptr sret({}) %return, ptr %c, ptr %b) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CCallCallGeneric.Main(ptr sret({}) %return, ptr %c, ptr %b) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CCallGeneric.Main.e9553e8b9469ef0b(ptr %return, ptr %c, ptr %b), !dbg !13 // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CF.C.Main:I.Main.e43630e9a6c38c3f"(ptr sret({}) %return, ptr %self, ptr %x) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CF.C.Main:I.Main.e43630e9a6c38c3f"(ptr sret({}) %return, ptr %self, ptr %x) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %return, ptr align 1 @B.val.loc18_42, i64 0, i1 false), !dbg !16 // CHECK:STDOUT: ret void, !dbg !16 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CCallGeneric.Main.e9553e8b9469ef0b(ptr sret({}) %return, ptr %c, ptr %b) !dbg !17 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CCallGeneric.Main.e9553e8b9469ef0b(ptr sret({}) %return, ptr %c, ptr %b) #0 !dbg !17 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @"_CF:thunk.C.Main:I.Main.e43630e9a6c38c3f"(ptr %return, ptr %c, ptr %b), !dbg !18 // CHECK:STDOUT: ret void, !dbg !19 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CF:thunk.C.Main:I.Main.e43630e9a6c38c3f"(ptr sret({}) %return, ptr %self, ptr %x) !dbg !20 { +// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CF:thunk.C.Main:I.Main.e43630e9a6c38c3f"(ptr sret({}) %return, ptr %self, ptr %x) #3 !dbg !20 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc18_31.2.temp = alloca {}, align 8, !dbg !21 // CHECK:STDOUT: %.loc18_31.6.temp = alloca {}, align 8, !dbg !21 @@ -241,8 +254,10 @@ fn CallCallGeneric(c: C(()), b: B) -> A { // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 0, 1, 2, 3, 8, 7, 6, 5, 4 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #3 = { alwaysinline nounwind } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/index/array_element_access.carbon b/toolchain/lower/testdata/index/array_element_access.carbon index a0a3f9e27cb22..f3edec94a8464 100644 --- a/toolchain/lower/testdata/index/array_element_access.carbon +++ b/toolchain/lower/testdata/index/array_element_access.carbon @@ -26,7 +26,8 @@ fn Run() { // CHECK:STDOUT: @tuple.loc12_37 = internal constant { i32, i32 } { i32 1, i32 2 } // CHECK:STDOUT: @array.loc14_40 = internal constant [2 x i32] [i32 1, i32 2] // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CA.Main(ptr sret({ i32, i32 }) %return) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CA.Main(ptr sret({ i32, i32 }) %return) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %tuple.elem0.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %tuple.elem1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7 @@ -34,7 +35,8 @@ fn Run() { // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CB.Main(ptr sret([2 x i32]) %return) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CB.Main(ptr sret([2 x i32]) %return) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc14_39.3.array.index = getelementptr inbounds [2 x i32], ptr %return, i32 0, i64 0, !dbg !10 // CHECK:STDOUT: %.loc14_39.6.array.index = getelementptr inbounds [2 x i32], ptr %return, i32 0, i64 1, !dbg !10 @@ -42,7 +44,8 @@ fn Run() { // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @main() !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @main() #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca [2 x i32], align 4, !dbg !13 // CHECK:STDOUT: %.loc17_28.1.temp = alloca { i32, i32 }, align 8, !dbg !14 @@ -78,17 +81,18 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 5, 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/interface/assoc.carbon b/toolchain/lower/testdata/interface/assoc.carbon index 65379ac92eed5..95aab23f9425d 100644 --- a/toolchain/lower/testdata/interface/assoc.carbon +++ b/toolchain/lower/testdata/interface/assoc.carbon @@ -19,11 +19,14 @@ fn F() { I.Assoc; } // CHECK:STDOUT: ; ModuleID = 'assoc.carbon' // CHECK:STDOUT: source_filename = "assoc.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/interface/basic.carbon b/toolchain/lower/testdata/interface/basic.carbon index 304cef8efe394..73fd233d9cf4a 100644 --- a/toolchain/lower/testdata/interface/basic.carbon +++ b/toolchain/lower/testdata/interface/basic.carbon @@ -25,19 +25,23 @@ fn H() -> I { return G(); } // CHECK:STDOUT: ; ModuleID = 'basic.carbon' // CHECK:STDOUT: source_filename = "basic.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main({} %T) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main({} %T) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare {} @_CG.Main() // CHECK:STDOUT: -// CHECK:STDOUT: define {} @_CH.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define {} @_CH.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %G.call = call {} @_CG.Main(), !dbg !9 // CHECK:STDOUT: ret {} %G.call, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/interface/where.carbon b/toolchain/lower/testdata/interface/where.carbon index 97395af48a2a8..513089ff8fa0f 100644 --- a/toolchain/lower/testdata/interface/where.carbon +++ b/toolchain/lower/testdata/interface/where.carbon @@ -25,11 +25,14 @@ impl C as I where .T = () { // CHECK:STDOUT: ; ModuleID = 'where.carbon' // CHECK:STDOUT: source_filename = "where.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_CF.C.Main:I.Main"() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_CF.C.Main:I.Main"() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/interop/cpp/base.carbon b/toolchain/lower/testdata/interop/cpp/base.carbon index 5a1a20199e7e8..b72f6fad8714a 100644 --- a/toolchain/lower/testdata/interop/cpp/base.carbon +++ b/toolchain/lower/testdata/interop/cpp/base.carbon @@ -63,7 +63,8 @@ fn Call(b: Cpp.B*) { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define ptr @_CConvertPtr.Main(ptr %p) !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define ptr @_CConvertPtr.Main(ptr %p) #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7_11.2.base = getelementptr inbounds nuw [8 x i8], ptr %p, i32 0, i32 0, !dbg !10 // CHECK:STDOUT: ret ptr %.loc7_11.2.base, !dbg !10 @@ -71,13 +72,16 @@ fn Call(b: Cpp.B*) { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CAcceptVal.Main(ptr) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CConvertVal.Main(ptr %b) !dbg !11 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CConvertVal.Main(ptr %b) #0 !dbg !11 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc13_13.1.base = getelementptr inbounds nuw [8 x i8], ptr %b, i32 0, i32 0, !dbg !12 // CHECK:STDOUT: call void @_CAcceptVal.Main(ptr %.loc13_13.1.base), !dbg !13 // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} // CHECK:STDOUT: @@ -101,7 +105,8 @@ fn Call(b: Cpp.B*) { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CAccessVal.Main(ptr %b) !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CAccessVal.Main(ptr %b) #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7_11.1.base = getelementptr inbounds nuw [8 x i8], ptr %b, i32 0, i32 0, !dbg !10 // CHECK:STDOUT: %.loc7_11.3.a = getelementptr inbounds nuw [4 x i8], ptr %.loc7_11.1.base, i32 0, i32 0, !dbg !10 @@ -109,6 +114,8 @@ fn Call(b: Cpp.B*) { // CHECK:STDOUT: ret i32 %.loc7_11.4, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} // CHECK:STDOUT: @@ -131,7 +138,8 @@ fn Call(b: Cpp.B*) { // CHECK:STDOUT: // CHECK:STDOUT: $_ZN1A1fEv = comdat any // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CCall.Main(ptr %b) !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CCall.Main(ptr %b) #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7_4.3.base = getelementptr inbounds nuw [8 x i8], ptr %b, i32 0, i32 0, !dbg !10 // CHECK:STDOUT: call void @_ZN1A1fEv(ptr %.loc7_4.3.base), !dbg !10 @@ -139,7 +147,7 @@ fn Call(b: Cpp.B*) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress noinline nounwind optnone -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1A1fEv(ptr nonnull align 4 dereferenceable(4) %this) #0 comdat align 2 { +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1A1fEv(ptr nonnull align 4 dereferenceable(4) %this) #1 comdat align 2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %this.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8 @@ -147,7 +155,8 @@ fn Call(b: Cpp.B*) { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} diff --git a/toolchain/lower/testdata/interop/cpp/constructor.carbon b/toolchain/lower/testdata/interop/cpp/constructor.carbon index 956a7c721eb0e..7f04566b912ad 100644 --- a/toolchain/lower/testdata/interop/cpp/constructor.carbon +++ b/toolchain/lower/testdata/interop/cpp/constructor.carbon @@ -46,7 +46,8 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: $_ZN1CC2Ev = comdat any // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7_26.1.temp = alloca [8 x i8], align 1, !dbg !10 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_26.1.temp), !dbg !10 @@ -55,10 +56,10 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_ZN1CC1Ev.carbon_thunk(ptr %return) #1 { +// CHECK:STDOUT: define dso_local void @_ZN1CC1Ev.carbon_thunk(ptr %return) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8 @@ -68,7 +69,7 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress noinline optnone -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1CC1Ev(ptr nonnull align 4 dereferenceable(8) %this) unnamed_addr #2 comdat align 2 { +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1CC1Ev(ptr nonnull align 4 dereferenceable(8) %this) unnamed_addr #3 comdat align 2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %this.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8 @@ -78,7 +79,7 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress noinline nounwind optnone -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1CC2Ev(ptr nonnull align 4 dereferenceable(8) %this) unnamed_addr #3 comdat align 2 { +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1CC2Ev(ptr nonnull align 4 dereferenceable(8) %this) unnamed_addr #4 comdat align 2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %this.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8 @@ -90,10 +91,11 @@ fn F() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { mustprogress noinline optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #3 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #3 = { mustprogress noinline optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #4 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} diff --git a/toolchain/lower/testdata/interop/cpp/enum.carbon b/toolchain/lower/testdata/interop/cpp/enum.carbon index 820dbf1f08161..09b65efcbe427 100644 --- a/toolchain/lower/testdata/interop/cpp/enum.carbon +++ b/toolchain/lower/testdata/interop/cpp/enum.carbon @@ -87,7 +87,8 @@ fn Call() { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CPass.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CPass.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7_16.1.temp = alloca i16, align 2, !dbg !10 // CHECK:STDOUT: %.loc8_16.1.temp = alloca i16, align 2, !dbg !11 @@ -121,10 +122,10 @@ fn Call() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_ZN1C1FENS_1EE.carbon_thunk(ptr %0) #1 { +// CHECK:STDOUT: define dso_local void @_ZN1C1FENS_1EE.carbon_thunk(ptr %0) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %0, ptr %.addr, align 8 @@ -134,14 +135,15 @@ fn Call() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_ZN1C1FENS_1EE(i16 signext) #2 +// CHECK:STDOUT: declare void @_ZN1C1FENS_1EE(i16 signext) #3 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 6, 5, 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -178,19 +180,22 @@ fn Call() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CTakeI16.Main(i16) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CPassEnum.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CPassEnum.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CTakeI16.Main(i16 7), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CConvertEnumToI16.Main(i16 %e) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CConvertEnumToI16.Main(i16 %e) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CTakeI16.Main(i16 %e), !dbg !13 // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CConvertI16ToEnum.Main(i16 %n) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CConvertI16ToEnum.Main(i16 %n) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc17_13.3.temp = alloca i16, align 2, !dbg !16 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc17_13.3.temp), !dbg !16 @@ -200,10 +205,10 @@ fn Call() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_ZN1C1FENS_1EE.carbon_thunk(ptr %0) #1 { +// CHECK:STDOUT: define dso_local void @_ZN1C1FENS_1EE.carbon_thunk(ptr %0) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %0, ptr %.addr, align 8 @@ -213,11 +218,12 @@ fn Call() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_ZN1C1FENS_1EE(i16 signext) #2 +// CHECK:STDOUT: declare void @_ZN1C1FENS_1EE(i16 signext) #3 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -246,7 +252,8 @@ fn Call() { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CCall.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CCall.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_Z4Take4Bits(i32 5), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 @@ -254,6 +261,8 @@ fn Call() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_Z4Take4Bits(i32) // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/interop/cpp/extern_c.carbon b/toolchain/lower/testdata/interop/cpp/extern_c.carbon index a393bbaad5768..996f0a6df3025 100644 --- a/toolchain/lower/testdata/interop/cpp/extern_c.carbon +++ b/toolchain/lower/testdata/interop/cpp/extern_c.carbon @@ -107,7 +107,8 @@ fn MyF() { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMyF.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMyF.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @foo(), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 @@ -115,6 +116,8 @@ fn MyF() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @foo() // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} // CHECK:STDOUT: @@ -135,7 +138,8 @@ fn MyF() { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMyF.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMyF.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @foo(), !dbg !10 // CHECK:STDOUT: call void @_Z3fooi(i32 5), !dbg !11 @@ -146,6 +150,8 @@ fn MyF() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_Z3fooi(i32) // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} // CHECK:STDOUT: @@ -169,12 +175,15 @@ fn MyF() { // CHECK:STDOUT: // CHECK:STDOUT: @foo = external global i32 // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CMyF.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CMyF.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7 = load i32, ptr @foo, align 4, !dbg !10 // CHECK:STDOUT: ret i32 %.loc7, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} // CHECK:STDOUT: @@ -197,14 +206,15 @@ fn MyF() { // CHECK:STDOUT: // CHECK:STDOUT: %struct.X = type { i8 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMyF.Main(ptr sret({}) %return, ptr %a, ptr %b) !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMyF.Main(ptr sret({}) %return, ptr %a, ptr %b) #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_Zpl1XS_.carbon_thunk(ptr %a, ptr %b, ptr %return), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Zpl1XS_.carbon_thunk(ptr %0, ptr %1, ptr %return) #0 { +// CHECK:STDOUT: define dso_local void @_Zpl1XS_.carbon_thunk(ptr %0, ptr %1, ptr %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %.addr1 = alloca ptr, align 8 @@ -222,10 +232,11 @@ fn MyF() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Zpl1XS_() #1 +// CHECK:STDOUT: declare void @_Zpl1XS_() #2 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -247,7 +258,8 @@ fn MyF() { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMyF.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMyF.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @bar(), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 @@ -255,6 +267,8 @@ fn MyF() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @bar() // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/interop/cpp/field.carbon b/toolchain/lower/testdata/interop/cpp/field.carbon index cea4d88caad58..d4d2255166d5f 100644 --- a/toolchain/lower/testdata/interop/cpp/field.carbon +++ b/toolchain/lower/testdata/interop/cpp/field.carbon @@ -113,20 +113,24 @@ fn AccessP(a: Cpp.A) -> i32 { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CAccessN.Main(ptr %a) !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CAccessN.Main(ptr %a) #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc9_11.1.n = getelementptr inbounds nuw [32 x i8], ptr %a, i32 0, i32 0, !dbg !10 // CHECK:STDOUT: %.loc9_11.2 = load i32, ptr %.loc9_11.1.n, align 4, !dbg !10 // CHECK:STDOUT: ret i32 %.loc9_11.2, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CAccessM.Main(ptr %a) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CAccessM.Main(ptr %a) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc13_11.1.m = getelementptr inbounds nuw [32 x i8], ptr %a, i32 0, i32 16, !dbg !13 // CHECK:STDOUT: %.loc13_11.2 = load i32, ptr %.loc13_11.1.m, align 4, !dbg !13 // CHECK:STDOUT: ret i32 %.loc13_11.2, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} // CHECK:STDOUT: @@ -150,20 +154,24 @@ fn AccessP(a: Cpp.A) -> i32 { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CAssignN.Main(ptr %p) !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CAssignN.Main(ptr %p) #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc9_4.2.n = getelementptr inbounds nuw [32 x i8], ptr %p, i32 0, i32 0, !dbg !10 // CHECK:STDOUT: store i32 1, ptr %.loc9_4.2.n, align 4, !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CAssignM.Main(ptr %p) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CAssignM.Main(ptr %p) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc13_4.2.m = getelementptr inbounds nuw [32 x i8], ptr %p, i32 0, i32 16, !dbg !13 // CHECK:STDOUT: store i32 1, ptr %.loc13_4.2.m, align 4, !dbg !13 // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} // CHECK:STDOUT: @@ -187,20 +195,24 @@ fn AccessP(a: Cpp.A) -> i32 { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CAccessN.Main(ptr %a) !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CAccessN.Main(ptr %a) #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7_11.1.n = getelementptr inbounds nuw [4 x i8], ptr %a, i32 0, i32 0, !dbg !10 // CHECK:STDOUT: %.loc7_11.2 = load i32, ptr %.loc7_11.1.n, align 4, !dbg !10 // CHECK:STDOUT: ret i32 %.loc7_11.2, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CAccessM.Main(ptr %a) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CAccessM.Main(ptr %a) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc11_11.1.m = getelementptr inbounds nuw [4 x i8], ptr %a, i32 0, i32 0, !dbg !13 // CHECK:STDOUT: %.loc11_11.2 = load i32, ptr %.loc11_11.1.m, align 4, !dbg !13 // CHECK:STDOUT: ret i32 %.loc11_11.2, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} // CHECK:STDOUT: @@ -224,20 +236,24 @@ fn AccessP(a: Cpp.A) -> i32 { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CAssignN.Main(ptr %p) !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CAssignN.Main(ptr %p) #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7_4.2.n = getelementptr inbounds nuw [4 x i8], ptr %p, i32 0, i32 0, !dbg !10 // CHECK:STDOUT: store i32 1, ptr %.loc7_4.2.n, align 4, !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CAssignM.Main(ptr %p) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CAssignM.Main(ptr %p) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc11_4.2.m = getelementptr inbounds nuw [4 x i8], ptr %p, i32 0, i32 0, !dbg !13 // CHECK:STDOUT: store i32 1, ptr %.loc11_4.2.m, align 4, !dbg !13 // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} // CHECK:STDOUT: @@ -261,14 +277,16 @@ fn AccessP(a: Cpp.A) -> i32 { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CAccessN.Main(ptr %a) !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CAccessN.Main(ptr %a) #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7_11.1.n = getelementptr inbounds nuw [16 x i8], ptr %a, i32 0, i32 8, !dbg !10 // CHECK:STDOUT: %.loc7_11.2 = load i32, ptr %.loc7_11.1.n, align 4, !dbg !10 // CHECK:STDOUT: ret i32 %.loc7_11.2, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CAccessP.Main(ptr %a) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CAccessP.Main(ptr %a) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc11_12.1.p = getelementptr inbounds nuw [16 x i8], ptr %a, i32 0, i32 8, !dbg !13 // CHECK:STDOUT: %.loc11_12.2 = load ptr, ptr %.loc11_12.1.p, align 8, !dbg !13 @@ -276,6 +294,8 @@ fn AccessP(a: Cpp.A) -> i32 { // CHECK:STDOUT: ret i32 %.loc11_10.2, !dbg !15 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/interop/cpp/function_decl.carbon b/toolchain/lower/testdata/interop/cpp/function_decl.carbon index ca469f56631fd..903d7e1009dfe 100644 --- a/toolchain/lower/testdata/interop/cpp/function_decl.carbon +++ b/toolchain/lower/testdata/interop/cpp/function_decl.carbon @@ -136,7 +136,8 @@ fn MyF() { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMyF.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMyF.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_Z3foov(), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 @@ -144,6 +145,8 @@ fn MyF() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_Z3foov() // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} // CHECK:STDOUT: @@ -166,19 +169,21 @@ fn MyF() { // CHECK:STDOUT: // CHECK:STDOUT: $_Z3foov = comdat any // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMyF.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMyF.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_Z3foov(), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress noinline nounwind optnone -// CHECK:STDOUT: define linkonce_odr dso_local void @_Z3foov() #0 comdat { +// CHECK:STDOUT: define linkonce_odr dso_local void @_Z3foov() #1 comdat { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -204,14 +209,15 @@ fn MyF() { // CHECK:STDOUT: // CHECK:STDOUT: @llvm.compiler.used = appending global [1 x ptr] [ptr @_Z3foov], section "llvm.metadata" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMyF.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMyF.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_Z3foov(), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress noinline nounwind optnone -// CHECK:STDOUT: define linkonce_odr dso_local void @_Z3foov() #0 comdat { +// CHECK:STDOUT: define linkonce_odr dso_local void @_Z3foov() #1 comdat { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } @@ -219,7 +225,8 @@ fn MyF() { // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @_Z3foov, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -247,7 +254,8 @@ fn MyF() { // CHECK:STDOUT: // CHECK:STDOUT: $_Z4foo3v = comdat any // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMyF.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMyF.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_Z4foo1v(), !dbg !10 // CHECK:STDOUT: call void @_Z4foo2v(), !dbg !11 @@ -256,24 +264,25 @@ fn MyF() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress noinline nounwind optnone -// CHECK:STDOUT: define linkonce_odr dso_local void @_Z4foo1v() #0 comdat { +// CHECK:STDOUT: define linkonce_odr dso_local void @_Z4foo1v() #1 comdat { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress noinline nounwind optnone -// CHECK:STDOUT: define linkonce_odr dso_local void @_Z4foo2v() #0 comdat { +// CHECK:STDOUT: define linkonce_odr dso_local void @_Z4foo2v() #1 comdat { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress noinline nounwind optnone -// CHECK:STDOUT: define linkonce_odr dso_local void @_Z4foo3v() #0 comdat { +// CHECK:STDOUT: define linkonce_odr dso_local void @_Z4foo3v() #1 comdat { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -301,27 +310,29 @@ fn MyF() { // CHECK:STDOUT: // CHECK:STDOUT: $_Z4foo1v = comdat any // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMyF.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMyF.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_Z4foo2v(), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress noinline optnone -// CHECK:STDOUT: define linkonce_odr dso_local void @_Z4foo2v() #0 comdat { +// CHECK:STDOUT: define linkonce_odr dso_local void @_Z4foo2v() #1 comdat { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_Z4foo1v() // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress noinline nounwind optnone -// CHECK:STDOUT: define linkonce_odr dso_local void @_Z4foo1v() #1 comdat { +// CHECK:STDOUT: define linkonce_odr dso_local void @_Z4foo1v() #2 comdat { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { mustprogress noinline optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { mustprogress noinline optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -343,7 +354,8 @@ fn MyF() { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMyF.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMyF.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %value.var = alloca i32, align 4, !dbg !10 // CHECK:STDOUT: call void @_Z13NoReturnValueii.carbon_thunk0(), !dbg !11 @@ -364,17 +376,17 @@ fn MyF() { // CHECK:STDOUT: declare i32 @_Z17SimpleReturnValueii(i32, i32) // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z13NoReturnValueii.carbon_thunk0() #1 { +// CHECK:STDOUT: define dso_local void @_Z13NoReturnValueii.carbon_thunk0() #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_Z13NoReturnValueii(i32 1, i32 2) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z13NoReturnValueii.carbon_thunk1(i32 %a) #1 { +// CHECK:STDOUT: define dso_local void @_Z13NoReturnValueii.carbon_thunk1(i32 %a) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.addr = alloca i32, align 4 // CHECK:STDOUT: store i32 %a, ptr %a.addr, align 4 @@ -384,14 +396,14 @@ fn MyF() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local i32 @_Z17SimpleReturnValueii.carbon_thunk0() #1 { +// CHECK:STDOUT: define dso_local i32 @_Z17SimpleReturnValueii.carbon_thunk0() #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %call = call i32 @_Z17SimpleReturnValueii(i32 1, i32 2) // CHECK:STDOUT: ret i32 %call // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local i32 @_Z17SimpleReturnValueii.carbon_thunk1(i32 %a) #1 { +// CHECK:STDOUT: define dso_local i32 @_Z17SimpleReturnValueii.carbon_thunk1(i32 %a) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.addr = alloca i32, align 4 // CHECK:STDOUT: store i32 %a, ptr %a.addr, align 4 @@ -400,8 +412,9 @@ fn MyF() { // CHECK:STDOUT: ret i32 %call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} diff --git a/toolchain/lower/testdata/interop/cpp/function_in_template.carbon b/toolchain/lower/testdata/interop/cpp/function_in_template.carbon index d5051ba9e7903..955fc67c56870 100644 --- a/toolchain/lower/testdata/interop/cpp/function_in_template.carbon +++ b/toolchain/lower/testdata/interop/cpp/function_in_template.carbon @@ -37,21 +37,23 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: $_ZN1XIiE1fEi = comdat any // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_ZN1XIiE1fEi(i32 42), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress noinline nounwind optnone -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1XIiE1fEi(i32 %t) #0 comdat align 2 { +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1XIiE1fEi(i32 %t) #1 comdat align 2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %t.addr = alloca i32, align 4 // CHECK:STDOUT: store i32 %t, ptr %t.addr, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} diff --git a/toolchain/lower/testdata/interop/cpp/globals.carbon b/toolchain/lower/testdata/interop/cpp/globals.carbon index d6a602f0751ee..6de4ef162c6ad 100644 --- a/toolchain/lower/testdata/interop/cpp/globals.carbon +++ b/toolchain/lower/testdata/interop/cpp/globals.carbon @@ -38,11 +38,14 @@ fn MyF() { // CHECK:STDOUT: // CHECK:STDOUT: @global = dso_local global %class.C zeroinitializer, align 1 // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMyF.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMyF.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/interop/cpp/import_inline.carbon b/toolchain/lower/testdata/interop/cpp/import_inline.carbon index 0bc309ccf4e3c..0da3be66da9fe 100644 --- a/toolchain/lower/testdata/interop/cpp/import_inline.carbon +++ b/toolchain/lower/testdata/interop/cpp/import_inline.carbon @@ -29,7 +29,8 @@ fn Call() -> i32 { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CCall.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CCall.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !10 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %n.var), !dbg !10 @@ -40,10 +41,10 @@ fn Call() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress noinline nounwind optnone -// CHECK:STDOUT: define dso_local void @_Z1FPi(ptr %p) #1 { +// CHECK:STDOUT: define dso_local void @_Z1FPi(ptr %p) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %p.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %p, ptr %p.addr, align 8 @@ -52,8 +53,9 @@ fn Call() -> i32 { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} diff --git a/toolchain/lower/testdata/interop/cpp/method.carbon b/toolchain/lower/testdata/interop/cpp/method.carbon index 01e93273e1bec..5862cf93ed73c 100644 --- a/toolchain/lower/testdata/interop/cpp/method.carbon +++ b/toolchain/lower/testdata/interop/cpp/method.carbon @@ -83,14 +83,15 @@ fn Call(n: Cpp.NeedThunk) { // CHECK:STDOUT: // CHECK:STDOUT: $_ZNK1A6by_valEv = comdat any // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CUseVal.Main(ptr %a) !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CUseVal.Main(ptr %a) #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %by_val__carbon_thunk.call = call i32 @_ZNK1A6by_valEv.carbon_thunk(ptr %a), !dbg !10 // CHECK:STDOUT: ret i32 %by_val__carbon_thunk.call, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local i32 @_ZNK1A6by_valEv.carbon_thunk(ptr nonnull align 8 dereferenceable(12) %this) #0 { +// CHECK:STDOUT: define dso_local i32 @_ZNK1A6by_valEv.carbon_thunk(ptr nonnull align 8 dereferenceable(12) %this) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %this.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8 @@ -100,7 +101,7 @@ fn Call(n: Cpp.NeedThunk) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress noinline nounwind optnone -// CHECK:STDOUT: define linkonce_odr dso_local i32 @_ZNK1A6by_valEv(ptr nonnull align 8 dereferenceable(12) %this) #1 comdat align 2 { +// CHECK:STDOUT: define linkonce_odr dso_local i32 @_ZNK1A6by_valEv(ptr nonnull align 8 dereferenceable(12) %this) #2 comdat align 2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %this.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8 @@ -110,8 +111,9 @@ fn Call(n: Cpp.NeedThunk) { // CHECK:STDOUT: ret i32 %0 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -139,14 +141,15 @@ fn Call(n: Cpp.NeedThunk) { // CHECK:STDOUT: // CHECK:STDOUT: $_ZN1A6by_refEv = comdat any // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CUseVal.Main(ptr %a) !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CUseVal.Main(ptr %a) #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %A.by_ref.call = call i32 @_ZN1A6by_refEv(ptr %a), !dbg !10 // CHECK:STDOUT: ret i32 %A.by_ref.call, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress noinline nounwind optnone -// CHECK:STDOUT: define linkonce_odr dso_local i32 @_ZN1A6by_refEv(ptr nonnull align 8 dereferenceable(12) %this) #0 comdat align 2 { +// CHECK:STDOUT: define linkonce_odr dso_local i32 @_ZN1A6by_refEv(ptr nonnull align 8 dereferenceable(12) %this) #1 comdat align 2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %this.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8 @@ -156,7 +159,8 @@ fn Call(n: Cpp.NeedThunk) { // CHECK:STDOUT: ret i32 %0 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -178,7 +182,8 @@ fn Call(n: Cpp.NeedThunk) { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CUseVal.Main(ptr %a) !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CUseVal.Main(ptr %a) #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7_4.3.base = getelementptr inbounds nuw [16 x i8], ptr %a, i32 0, i32 0, !dbg !10 // CHECK:STDOUT: %Base.virt0.call.vtable = load ptr, ptr %.loc7_4.3.base, align 8, !dbg !10 @@ -196,6 +201,8 @@ fn Call(n: Cpp.NeedThunk) { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_ZN1A5virt1Ev(ptr) // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} // CHECK:STDOUT: @@ -219,7 +226,8 @@ fn Call(n: Cpp.NeedThunk) { // CHECK:STDOUT: // CHECK:STDOUT: %struct.NeedThunk = type { i8 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CCall.Main(ptr %n) !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CCall.Main(ptr %n) #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7_14.3.temp = alloca i8, align 1, !dbg !10 // CHECK:STDOUT: %.loc8_14.3.temp = alloca i8, align 1, !dbg !11 @@ -233,10 +241,10 @@ fn Call(n: Cpp.NeedThunk) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_ZNK9NeedThunk8ImplicitEa.carbon_thunk(ptr nonnull align 1 dereferenceable(1) %this, ptr %c) #1 { +// CHECK:STDOUT: define dso_local void @_ZNK9NeedThunk8ImplicitEa.carbon_thunk(ptr nonnull align 1 dereferenceable(1) %this, ptr %c) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %this.addr = alloca ptr, align 8 // CHECK:STDOUT: %c.addr = alloca ptr, align 8 @@ -249,10 +257,10 @@ fn Call(n: Cpp.NeedThunk) { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_ZNK9NeedThunk8ImplicitEa(ptr nonnull align 1 dereferenceable(1), i8 signext) #2 +// CHECK:STDOUT: declare void @_ZNK9NeedThunk8ImplicitEa(ptr nonnull align 1 dereferenceable(1), i8 signext) #3 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_ZNH9NeedThunk8ExplicitES_a.carbon_thunk(ptr %0, ptr %c) #1 { +// CHECK:STDOUT: define dso_local void @_ZNH9NeedThunk8ExplicitES_a.carbon_thunk(ptr %0, ptr %c) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %c.addr = alloca ptr, align 8 @@ -266,14 +274,15 @@ fn Call(n: Cpp.NeedThunk) { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_ZNH9NeedThunk8ExplicitES_a(i8 signext) #2 +// CHECK:STDOUT: declare void @_ZNH9NeedThunk8ExplicitES_a(i8 signext) #3 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} diff --git a/toolchain/lower/testdata/interop/cpp/parameters.carbon b/toolchain/lower/testdata/interop/cpp/parameters.carbon index 70a357b747b53..b3114e575d13b 100644 --- a/toolchain/lower/testdata/interop/cpp/parameters.carbon +++ b/toolchain/lower/testdata/interop/cpp/parameters.carbon @@ -115,7 +115,8 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: // CHECK:STDOUT: @_Cc.Main = global i16 0 // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMyF.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMyF.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7_19.3.temp = alloca i8, align 1, !dbg !10 // CHECK:STDOUT: %.loc7_22.3.temp = alloca i16, align 2, !dbg !11 @@ -136,7 +137,8 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: // CHECK:STDOUT: declare i16 @_CMakeShort.Main() // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CPassShort.Main(i16 %a, ptr %b) !dbg !17 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CPassShort.Main(i16 %a, ptr %b) #0 !dbg !17 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc17_18.1.temp = alloca i16, align 2, !dbg !18 // CHECK:STDOUT: %.loc18_18.3.temp = alloca i16, align 2, !dbg !19 @@ -161,10 +163,10 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z11pass_signedasil.carbon_thunk(ptr %0, ptr %1, i32 %2, i64 %3) #1 { +// CHECK:STDOUT: define dso_local void @_Z11pass_signedasil.carbon_thunk(ptr %0, ptr %1, i32 %2, i64 %3) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %.addr1 = alloca ptr, align 8 @@ -184,10 +186,10 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z11pass_signedasil(i8 signext, i16 signext, i32, i64) #2 +// CHECK:STDOUT: declare void @_Z11pass_signedasil(i8 signext, i16 signext, i32, i64) #3 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z13pass_unsignedhtjm.carbon_thunk(ptr %0, ptr %1, i32 %2, i64 %3) #1 { +// CHECK:STDOUT: define dso_local void @_Z13pass_unsignedhtjm.carbon_thunk(ptr %0, ptr %1, i32 %2, i64 %3) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %.addr1 = alloca ptr, align 8 @@ -207,10 +209,10 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z13pass_unsignedhtjm(i8 zeroext, i16 zeroext, i32, i64) #2 +// CHECK:STDOUT: declare void @_Z13pass_unsignedhtjm(i8 zeroext, i16 zeroext, i32, i64) #3 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z10pass_shorts.carbon_thunk(ptr %0) #1 { +// CHECK:STDOUT: define dso_local void @_Z10pass_shorts.carbon_thunk(ptr %0) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %0, ptr %.addr, align 8 @@ -220,14 +222,15 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z10pass_shorts(i16 signext) #2 +// CHECK:STDOUT: declare void @_Z10pass_shorts(i16 signext) #3 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 7, 6, 5, 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -266,7 +269,8 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: // CHECK:STDOUT: %struct.X = type { i32, i32, i32 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CTest.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTest.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca [12 x i8], align 1, !dbg !10 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %x.var), !dbg !10 @@ -281,10 +285,10 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z11pass_struct1X.carbon_thunk(ptr %0) #1 { +// CHECK:STDOUT: define dso_local void @_Z11pass_struct1X.carbon_thunk(ptr %0) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %struct.X, align 4 @@ -302,17 +306,18 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #3 // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z11pass_struct1X(i64, i32) #3 +// CHECK:STDOUT: declare void @_Z11pass_struct1X(i64, i32) #4 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -340,7 +345,8 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: // CHECK:STDOUT: %class.Y = type { i32, i32, i32 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CPassRefExpr.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CPassRefExpr.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %y.var = alloca [12 x i8], align 1, !dbg !10 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %y.var), !dbg !10 @@ -356,7 +362,8 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CMake.Main(ptr sret([12 x i8])) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CPassInitExpr.Main() !dbg !16 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CPassInitExpr.Main() #0 !dbg !16 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc17_24.1.temp = alloca [12 x i8], align 1, !dbg !17 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc17_24.1.temp), !dbg !17 @@ -365,17 +372,18 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: ret void, !dbg !19 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CPassValueExpr.Main(ptr %y) !dbg !20 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CPassValueExpr.Main(ptr %y) #0 !dbg !20 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_Z11pass_struct1Y.carbon_thunk(ptr %y), !dbg !21 // CHECK:STDOUT: ret void, !dbg !22 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z11pass_struct1Y.carbon_thunk(ptr %0) #1 { +// CHECK:STDOUT: define dso_local void @_Z11pass_struct1Y.carbon_thunk(ptr %0) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %class.Y, align 4 @@ -386,16 +394,17 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_ZN1YC1ERKS_(ptr nonnull align 4 dereferenceable(12), ptr nonnull align 4 dereferenceable(12)) unnamed_addr #2 +// CHECK:STDOUT: declare void @_ZN1YC1ERKS_(ptr nonnull align 4 dereferenceable(12), ptr nonnull align 4 dereferenceable(12)) unnamed_addr #3 // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z11pass_struct1Y(ptr dead_on_return) #2 +// CHECK:STDOUT: declare void @_Z11pass_struct1Y(ptr dead_on_return) #3 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} diff --git a/toolchain/lower/testdata/interop/cpp/reference.carbon b/toolchain/lower/testdata/interop/cpp/reference.carbon index 3816843628c18..76dc8fc41407b 100644 --- a/toolchain/lower/testdata/interop/cpp/reference.carbon +++ b/toolchain/lower/testdata/interop/cpp/reference.carbon @@ -135,7 +135,8 @@ fn GetRefs() { // CHECK:STDOUT: // CHECK:STDOUT: @C.val.loc19_18.3 = internal constant {} zeroinitializer // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CPassRefs.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CPassRefs.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c.var = alloca {}, align 8, !dbg !10 // CHECK:STDOUT: %.loc19_18.2.temp = alloca {}, align 8, !dbg !11 @@ -165,13 +166,13 @@ fn GetRefs() { // CHECK:STDOUT: declare void @_Z10TakeIntRefRi(ptr) // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z9TakeCRRefO1C.carbon_thunk(ptr %0) #2 { +// CHECK:STDOUT: define dso_local void @_Z9TakeCRRefO1C.carbon_thunk(ptr %0) #3 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %0, ptr %.addr, align 8 @@ -180,10 +181,10 @@ fn GetRefs() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z9TakeCRRefO1C(ptr nonnull align 1 dereferenceable(1)) #3 +// CHECK:STDOUT: declare void @_Z9TakeCRRefO1C(ptr nonnull align 1 dereferenceable(1)) #4 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z13TakeConstCRefRK1C.carbon_thunk(ptr %0) #2 { +// CHECK:STDOUT: define dso_local void @_Z13TakeConstCRefRK1C.carbon_thunk(ptr %0) #3 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %0, ptr %.addr, align 8 @@ -192,10 +193,10 @@ fn GetRefs() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z13TakeConstCRefRK1C(ptr nonnull align 1 dereferenceable(1)) #3 +// CHECK:STDOUT: declare void @_Z13TakeConstCRefRK1C(ptr nonnull align 1 dereferenceable(1)) #4 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z11TakeIntRRefOi.carbon_thunk(ptr %0) #2 { +// CHECK:STDOUT: define dso_local void @_Z11TakeIntRRefOi.carbon_thunk(ptr %0) #3 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %0, ptr %.addr, align 8 @@ -204,10 +205,10 @@ fn GetRefs() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z11TakeIntRRefOi(ptr nonnull align 4 dereferenceable(4)) #3 +// CHECK:STDOUT: declare void @_Z11TakeIntRRefOi(ptr nonnull align 4 dereferenceable(4)) #4 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z15TakeConstIntRefRKi.carbon_thunk(ptr %0) #2 { +// CHECK:STDOUT: define dso_local void @_Z15TakeConstIntRefRKi.carbon_thunk(ptr %0) #3 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %0, ptr %.addr, align 8 @@ -216,15 +217,16 @@ fn GetRefs() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z15TakeConstIntRefRKi(ptr nonnull align 4 dereferenceable(4)) #3 +// CHECK:STDOUT: declare void @_Z15TakeConstIntRefRKi(ptr nonnull align 4 dereferenceable(4)) #4 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #2 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #3 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -260,7 +262,8 @@ fn GetRefs() { // CHECK:STDOUT: // CHECK:STDOUT: @C.val.loc20_18.3 = internal constant {} zeroinitializer // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CPassRefs.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CPassRefs.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c.var = alloca {}, align 8, !dbg !10 // CHECK:STDOUT: %.loc20_18.2.temp = alloca {}, align 8, !dbg !11 @@ -286,13 +289,13 @@ fn GetRefs() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z8TakeCRefR1C10ForceThunk.carbon_thunk1(ptr nonnull align 1 dereferenceable(1) %0) #2 { +// CHECK:STDOUT: define dso_local void @_Z8TakeCRefR1C10ForceThunk.carbon_thunk1(ptr nonnull align 1 dereferenceable(1) %0) #3 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 @@ -302,10 +305,10 @@ fn GetRefs() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z8TakeCRefR1C10ForceThunk(ptr nonnull align 1 dereferenceable(1)) #3 +// CHECK:STDOUT: declare void @_Z8TakeCRefR1C10ForceThunk(ptr nonnull align 1 dereferenceable(1)) #4 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z9TakeCRRefRK1C10ForceThunk.carbon_thunk1(ptr %0) #2 { +// CHECK:STDOUT: define dso_local void @_Z9TakeCRRefRK1C10ForceThunk.carbon_thunk1(ptr %0) #3 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 @@ -315,10 +318,10 @@ fn GetRefs() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z9TakeCRRefRK1C10ForceThunk(ptr nonnull align 1 dereferenceable(1)) #3 +// CHECK:STDOUT: declare void @_Z9TakeCRRefRK1C10ForceThunk(ptr nonnull align 1 dereferenceable(1)) #4 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z13TakeConstCRefRK1C10ForceThunk.carbon_thunk1(ptr %0) #2 { +// CHECK:STDOUT: define dso_local void @_Z13TakeConstCRefRK1C10ForceThunk.carbon_thunk1(ptr %0) #3 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 @@ -328,10 +331,10 @@ fn GetRefs() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z13TakeConstCRefRK1C10ForceThunk(ptr nonnull align 1 dereferenceable(1)) #3 +// CHECK:STDOUT: declare void @_Z13TakeConstCRefRK1C10ForceThunk(ptr nonnull align 1 dereferenceable(1)) #4 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z10TakeIntRefRi10ForceThunk.carbon_thunk1(ptr nonnull align 4 dereferenceable(4) %0) #2 { +// CHECK:STDOUT: define dso_local void @_Z10TakeIntRefRi10ForceThunk.carbon_thunk1(ptr nonnull align 4 dereferenceable(4) %0) #3 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 @@ -341,10 +344,10 @@ fn GetRefs() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z10TakeIntRefRi10ForceThunk(ptr nonnull align 4 dereferenceable(4)) #3 +// CHECK:STDOUT: declare void @_Z10TakeIntRefRi10ForceThunk(ptr nonnull align 4 dereferenceable(4)) #4 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z11TakeIntRRefOi10ForceThunk.carbon_thunk1(ptr %0) #2 { +// CHECK:STDOUT: define dso_local void @_Z11TakeIntRRefOi10ForceThunk.carbon_thunk1(ptr %0) #3 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 @@ -354,10 +357,10 @@ fn GetRefs() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z11TakeIntRRefOi10ForceThunk(ptr nonnull align 4 dereferenceable(4)) #3 +// CHECK:STDOUT: declare void @_Z11TakeIntRRefOi10ForceThunk(ptr nonnull align 4 dereferenceable(4)) #4 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z15TakeConstIntRefRKi10ForceThunk.carbon_thunk1(ptr %0) #2 { +// CHECK:STDOUT: define dso_local void @_Z15TakeConstIntRefRKi10ForceThunk.carbon_thunk1(ptr %0) #3 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 @@ -367,15 +370,16 @@ fn GetRefs() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z15TakeConstIntRefRKi10ForceThunk(ptr nonnull align 4 dereferenceable(4)) #3 +// CHECK:STDOUT: declare void @_Z15TakeConstIntRefRKi10ForceThunk(ptr nonnull align 4 dereferenceable(4)) #4 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #2 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #3 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -408,7 +412,8 @@ fn GetRefs() { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CGetRefs.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CGetRefs.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c1.var = alloca ptr, align 8, !dbg !10 // CHECK:STDOUT: %c2.var = alloca ptr, align 8, !dbg !11 @@ -450,12 +455,13 @@ fn GetRefs() { // CHECK:STDOUT: declare ptr @_Z17ReturnConstIntRefv() // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 5, 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -490,7 +496,8 @@ fn GetRefs() { // CHECK:STDOUT: // CHECK:STDOUT: %class.ForceThunk = type { i8 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CGetRefs.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CGetRefs.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c1.var = alloca ptr, align 8, !dbg !10 // CHECK:STDOUT: %c2.var = alloca ptr, align 8, !dbg !11 @@ -520,74 +527,75 @@ fn GetRefs() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local nonnull align 1 dereferenceable(1) ptr @_Z10ReturnCRef10ForceThunk.carbon_thunk0() #1 { +// CHECK:STDOUT: define dso_local nonnull align 1 dereferenceable(1) ptr @_Z10ReturnCRef10ForceThunk.carbon_thunk0() #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 // CHECK:STDOUT: %call = call nonnull align 1 dereferenceable(1) ptr @_Z10ReturnCRef10ForceThunk() // CHECK:STDOUT: ret ptr %call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare nonnull align 1 dereferenceable(1) ptr @_Z10ReturnCRef10ForceThunk() #2 +// CHECK:STDOUT: declare nonnull align 1 dereferenceable(1) ptr @_Z10ReturnCRef10ForceThunk() #3 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local nonnull align 1 dereferenceable(1) ptr @_Z11ReturnCRRef10ForceThunk.carbon_thunk0() #1 { +// CHECK:STDOUT: define dso_local nonnull align 1 dereferenceable(1) ptr @_Z11ReturnCRRef10ForceThunk.carbon_thunk0() #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 // CHECK:STDOUT: %call = call nonnull align 1 dereferenceable(1) ptr @_Z11ReturnCRRef10ForceThunk() // CHECK:STDOUT: ret ptr %call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare nonnull align 1 dereferenceable(1) ptr @_Z11ReturnCRRef10ForceThunk() #2 +// CHECK:STDOUT: declare nonnull align 1 dereferenceable(1) ptr @_Z11ReturnCRRef10ForceThunk() #3 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local nonnull align 1 dereferenceable(1) ptr @_Z15ReturnConstCRef10ForceThunk.carbon_thunk0() #1 { +// CHECK:STDOUT: define dso_local nonnull align 1 dereferenceable(1) ptr @_Z15ReturnConstCRef10ForceThunk.carbon_thunk0() #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 // CHECK:STDOUT: %call = call nonnull align 1 dereferenceable(1) ptr @_Z15ReturnConstCRef10ForceThunk() // CHECK:STDOUT: ret ptr %call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare nonnull align 1 dereferenceable(1) ptr @_Z15ReturnConstCRef10ForceThunk() #2 +// CHECK:STDOUT: declare nonnull align 1 dereferenceable(1) ptr @_Z15ReturnConstCRef10ForceThunk() #3 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local nonnull align 4 dereferenceable(4) ptr @_Z12ReturnIntRef10ForceThunk.carbon_thunk0() #1 { +// CHECK:STDOUT: define dso_local nonnull align 4 dereferenceable(4) ptr @_Z12ReturnIntRef10ForceThunk.carbon_thunk0() #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 // CHECK:STDOUT: %call = call nonnull align 4 dereferenceable(4) ptr @_Z12ReturnIntRef10ForceThunk() // CHECK:STDOUT: ret ptr %call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare nonnull align 4 dereferenceable(4) ptr @_Z12ReturnIntRef10ForceThunk() #2 +// CHECK:STDOUT: declare nonnull align 4 dereferenceable(4) ptr @_Z12ReturnIntRef10ForceThunk() #3 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local nonnull align 4 dereferenceable(4) ptr @_Z13ReturnIntRRef10ForceThunk.carbon_thunk0() #1 { +// CHECK:STDOUT: define dso_local nonnull align 4 dereferenceable(4) ptr @_Z13ReturnIntRRef10ForceThunk.carbon_thunk0() #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 // CHECK:STDOUT: %call = call nonnull align 4 dereferenceable(4) ptr @_Z13ReturnIntRRef10ForceThunk() // CHECK:STDOUT: ret ptr %call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare nonnull align 4 dereferenceable(4) ptr @_Z13ReturnIntRRef10ForceThunk() #2 +// CHECK:STDOUT: declare nonnull align 4 dereferenceable(4) ptr @_Z13ReturnIntRRef10ForceThunk() #3 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local nonnull align 4 dereferenceable(4) ptr @_Z17ReturnConstIntRef10ForceThunk.carbon_thunk0() #1 { +// CHECK:STDOUT: define dso_local nonnull align 4 dereferenceable(4) ptr @_Z17ReturnConstIntRef10ForceThunk.carbon_thunk0() #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 // CHECK:STDOUT: %call = call nonnull align 4 dereferenceable(4) ptr @_Z17ReturnConstIntRef10ForceThunk() // CHECK:STDOUT: ret ptr %call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare nonnull align 4 dereferenceable(4) ptr @_Z17ReturnConstIntRef10ForceThunk() #2 +// CHECK:STDOUT: declare nonnull align 4 dereferenceable(4) ptr @_Z17ReturnConstIntRef10ForceThunk() #3 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 5, 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} diff --git a/toolchain/lower/testdata/interop/cpp/return.carbon b/toolchain/lower/testdata/interop/cpp/return.carbon index 2c335bad6cf06..c42e57676b45d 100644 --- a/toolchain/lower/testdata/interop/cpp/return.carbon +++ b/toolchain/lower/testdata/interop/cpp/return.carbon @@ -103,7 +103,8 @@ fn Var() { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: define i8 @_CGetU8.Main() !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i8 @_CGetU8.Main() #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc6_40.1.temp = alloca i8, align 1, !dbg !10 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc6_40.1.temp), !dbg !10 @@ -112,7 +113,8 @@ fn Var() { // CHECK:STDOUT: ret i8 %.loc6_40.2, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @_CGetU16.Main() !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_CGetU16.Main() #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7_43.1.temp = alloca i16, align 2, !dbg !13 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_43.1.temp), !dbg !13 @@ -121,7 +123,8 @@ fn Var() { // CHECK:STDOUT: ret i16 %.loc7_43.2, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CGetU32.Main() !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CGetU32.Main() #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ReturnU32.call = call i32 @_Z9ReturnU32v(), !dbg !16 // CHECK:STDOUT: ret i32 %ReturnU32.call, !dbg !17 @@ -129,7 +132,8 @@ fn Var() { // CHECK:STDOUT: // CHECK:STDOUT: declare i32 @_Z9ReturnU32v() // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CGetU64.Main() !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CGetU64.Main() #0 !dbg !18 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ReturnU64.call = call i64 @_Z9ReturnU64v(), !dbg !19 // CHECK:STDOUT: ret i64 %ReturnU64.call, !dbg !20 @@ -137,7 +141,8 @@ fn Var() { // CHECK:STDOUT: // CHECK:STDOUT: declare i64 @_Z9ReturnU64v() // CHECK:STDOUT: -// CHECK:STDOUT: define i8 @_CGetI8.Main() !dbg !21 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i8 @_CGetI8.Main() #0 !dbg !21 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc11_40.1.temp = alloca i8, align 1, !dbg !22 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc11_40.1.temp), !dbg !22 @@ -146,7 +151,8 @@ fn Var() { // CHECK:STDOUT: ret i8 %.loc11_40.2, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @_CGetI16.Main() !dbg !24 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_CGetI16.Main() #0 !dbg !24 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc12_43.1.temp = alloca i16, align 2, !dbg !25 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc12_43.1.temp), !dbg !25 @@ -155,7 +161,8 @@ fn Var() { // CHECK:STDOUT: ret i16 %.loc12_43.2, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CGetI32.Main() !dbg !27 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CGetI32.Main() #0 !dbg !27 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ReturnI32.call = call i32 @_Z9ReturnI32v(), !dbg !28 // CHECK:STDOUT: ret i32 %ReturnI32.call, !dbg !29 @@ -163,7 +170,8 @@ fn Var() { // CHECK:STDOUT: // CHECK:STDOUT: declare i32 @_Z9ReturnI32v() // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CGetI64.Main() !dbg !30 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CGetI64.Main() #0 !dbg !30 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ReturnI64.call = call i64 @_Z9ReturnI64v(), !dbg !31 // CHECK:STDOUT: ret i64 %ReturnI64.call, !dbg !32 @@ -173,7 +181,8 @@ fn Var() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CUse.Main(i8, i16, i32, i64, i8, i16, i32, i64) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CLets.Main() !dbg !33 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CLets.Main() #0 !dbg !33 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc19_32.1.temp = alloca i8, align 1, !dbg !34 // CHECK:STDOUT: %.loc20_35.1.temp = alloca i16, align 2, !dbg !35 @@ -199,7 +208,8 @@ fn Var() { // CHECK:STDOUT: ret void, !dbg !43 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CVars.Main() !dbg !44 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CVars.Main() #0 !dbg !44 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %my_u8.var = alloca i8, align 1, !dbg !45 // CHECK:STDOUT: %.loc33_32.1.temp = alloca i8, align 1, !dbg !46 @@ -258,10 +268,10 @@ fn Var() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z8ReturnU8v.carbon_thunk(ptr %return) #1 { +// CHECK:STDOUT: define dso_local void @_Z8ReturnU8v.carbon_thunk(ptr %return) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8 @@ -271,10 +281,10 @@ fn Var() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare zeroext i8 @_Z8ReturnU8v() #2 +// CHECK:STDOUT: declare zeroext i8 @_Z8ReturnU8v() #3 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z9ReturnU16v.carbon_thunk(ptr %return) #1 { +// CHECK:STDOUT: define dso_local void @_Z9ReturnU16v.carbon_thunk(ptr %return) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8 @@ -284,10 +294,10 @@ fn Var() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare zeroext i16 @_Z9ReturnU16v() #2 +// CHECK:STDOUT: declare zeroext i16 @_Z9ReturnU16v() #3 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z8ReturnI8v.carbon_thunk(ptr %return) #1 { +// CHECK:STDOUT: define dso_local void @_Z8ReturnI8v.carbon_thunk(ptr %return) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8 @@ -297,10 +307,10 @@ fn Var() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare signext i8 @_Z8ReturnI8v() #2 +// CHECK:STDOUT: declare signext i8 @_Z8ReturnI8v() #3 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z9ReturnI16v.carbon_thunk(ptr %return) #1 { +// CHECK:STDOUT: define dso_local void @_Z9ReturnI16v.carbon_thunk(ptr %return) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8 @@ -310,14 +320,15 @@ fn Var() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare signext i16 @_Z9ReturnI16v() #2 +// CHECK:STDOUT: declare signext i16 @_Z9ReturnI16v() #3 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -400,13 +411,15 @@ fn Var() { // CHECK:STDOUT: // CHECK:STDOUT: %struct.X = type { ptr, ptr } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CGetX.Main(ptr sret([16 x i8]) %return) !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CGetX.Main(ptr sret([16 x i8]) %return) #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_Z4Makev.carbon_thunk(ptr %return), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CLet.Main() !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CLet.Main() #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc9_27.1.temp = alloca [16 x i8], align 1, !dbg !13 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc9_27.1.temp), !dbg !13 @@ -414,7 +427,8 @@ fn Var() { // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CVar.Main() !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CVar.Main() #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca [16 x i8], align 1, !dbg !16 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %x.var), !dbg !16 @@ -423,10 +437,10 @@ fn Var() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z4Makev.carbon_thunk(ptr %return) #1 { +// CHECK:STDOUT: define dso_local void @_Z4Makev.carbon_thunk(ptr %return) #2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 // CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8 @@ -435,14 +449,15 @@ fn Var() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z4Makev(ptr dead_on_unwind writable sret(%struct.X) align 8) #2 +// CHECK:STDOUT: declare void @_Z4Makev(ptr dead_on_unwind writable sret(%struct.X) align 8) #3 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} diff --git a/toolchain/lower/testdata/interop/cpp/template.carbon b/toolchain/lower/testdata/interop/cpp/template.carbon index 7846471499022..6cc1cfee0ac90 100644 --- a/toolchain/lower/testdata/interop/cpp/template.carbon +++ b/toolchain/lower/testdata/interop/cpp/template.carbon @@ -41,20 +41,22 @@ fn PassClass(a: Cpp.Class) -> Cpp.Class { // CHECK:STDOUT: // CHECK:STDOUT: $_Z8identityIiET_S0_ = comdat any // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CPassI32.Main(i32 %a) !dbg !7 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CPassI32.Main(i32 %a) #0 !dbg !7 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %identity.call = call i32 @_Z8identityIiET_S0_(i32 %a), !dbg !10 // CHECK:STDOUT: ret i32 %identity.call, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CPassClass.Main(ptr sret({}) %return, ptr %a) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CPassClass.Main(ptr sret({}) %return, ptr %a) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_Z8identityI5ClassET_S1_.carbon_thunk(ptr %a, ptr %return), !dbg !13 // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress -// CHECK:STDOUT: define dso_local void @_Z8identityI5ClassET_S1_.carbon_thunk(ptr %x, ptr %return) #0 { +// CHECK:STDOUT: define dso_local void @_Z8identityI5ClassET_S1_.carbon_thunk(ptr %x, ptr %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.addr = alloca ptr, align 8 // CHECK:STDOUT: %return.addr = alloca ptr, align 8 @@ -69,14 +71,14 @@ fn PassClass(a: Cpp.Class) -> Cpp.Class { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress noinline nounwind optnone -// CHECK:STDOUT: define linkonce_odr dso_local void @_Z8identityI5ClassET_S1_() #1 comdat { +// CHECK:STDOUT: define linkonce_odr dso_local void @_Z8identityI5ClassET_S1_() #2 comdat { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x = alloca %class.Class, align 1 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress noinline nounwind optnone -// CHECK:STDOUT: define linkonce_odr dso_local i32 @_Z8identityIiET_S0_(i32 %x) #1 comdat { +// CHECK:STDOUT: define linkonce_odr dso_local i32 @_Z8identityIiET_S0_(i32 %x) #2 comdat { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.addr = alloca i32, align 4 // CHECK:STDOUT: store i32 %x, ptr %x.addr, align 4 @@ -84,8 +86,9 @@ fn PassClass(a: Cpp.Class) -> Cpp.Class { // CHECK:STDOUT: ret i32 %0 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="0" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} diff --git a/toolchain/lower/testdata/let/copy_value_rep.carbon b/toolchain/lower/testdata/let/copy_value_rep.carbon index 17ba45cf0d15d..aa21c0627414b 100644 --- a/toolchain/lower/testdata/let/copy_value_rep.carbon +++ b/toolchain/lower/testdata/let/copy_value_rep.carbon @@ -27,7 +27,8 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: @X.val.loc18_3 = internal constant { i32 } { i32 1 } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca { i32 }, align 8, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %x.var), !dbg !7 @@ -41,13 +42,14 @@ fn Run() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/let/local.carbon b/toolchain/lower/testdata/let/local.carbon index 9a18743637ae0..24a834ada8d1f 100644 --- a/toolchain/lower/testdata/let/local.carbon +++ b/toolchain/lower/testdata/let/local.carbon @@ -19,11 +19,14 @@ fn Run() -> i32 { // CHECK:STDOUT: ; ModuleID = 'local.carbon' // CHECK:STDOUT: source_filename = "local.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 1, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/let/tuple.carbon b/toolchain/lower/testdata/let/tuple.carbon index d6cafb7b40f14..cd0381b4a59a1 100644 --- a/toolchain/lower/testdata/let/tuple.carbon +++ b/toolchain/lower/testdata/let/tuple.carbon @@ -23,7 +23,8 @@ fn F() -> i32 { // CHECK:STDOUT: @tuple.ee6.loc14_3 = internal constant { i32, i32, i32 } { i32 1, i32 2, i32 3 } // CHECK:STDOUT: @tuple.0a0.loc15_3 = internal constant { i32, i32 } { i32 4, i32 5 } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca { i32, i32, i32 }, align 8, !dbg !7 // CHECK:STDOUT: %b.var = alloca { i32, i32 }, align 8, !dbg !8 @@ -71,17 +72,18 @@ fn F() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/namespace/function.carbon b/toolchain/lower/testdata/namespace/function.carbon index 1ed1537741657..2a127309d15a7 100644 --- a/toolchain/lower/testdata/namespace/function.carbon +++ b/toolchain/lower/testdata/namespace/function.carbon @@ -26,22 +26,27 @@ fn Bar() { // CHECK:STDOUT: ; ModuleID = 'function.carbon' // CHECK:STDOUT: source_filename = "function.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CBaz.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CBaz.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CBaz.Foo.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CBaz.Foo.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CBar.Main() !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CBar.Main() #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CBaz.Foo.Main(), !dbg !11 // CHECK:STDOUT: ret void, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/namespace/nested.carbon b/toolchain/lower/testdata/namespace/nested.carbon index c073c92d4735b..e552a7215e9f3 100644 --- a/toolchain/lower/testdata/namespace/nested.carbon +++ b/toolchain/lower/testdata/namespace/nested.carbon @@ -23,17 +23,21 @@ fn Foo.Bar.Baz() { // CHECK:STDOUT: ; ModuleID = 'nested.carbon' // CHECK:STDOUT: source_filename = "nested.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CWiz.Bar.Foo.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CWiz.Bar.Foo.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CBaz.Bar.Foo.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CBaz.Bar.Foo.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CWiz.Bar.Foo.Main(), !dbg !9 // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/operators/and.carbon b/toolchain/lower/testdata/operators/and.carbon index 774494520d009..1311101f4a64f 100644 --- a/toolchain/lower/testdata/operators/and.carbon +++ b/toolchain/lower/testdata/operators/and.carbon @@ -20,17 +20,20 @@ fn And() -> bool { // CHECK:STDOUT: ; ModuleID = 'and.carbon' // CHECK:STDOUT: source_filename = "and.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i1 true, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CG.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CG.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i1 true, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CAnd.Main() !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CAnd.Main() #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %F.call = call i1 @_CF.Main(), !dbg !11 // CHECK:STDOUT: br i1 %F.call, label %and.rhs, label %and.result, !dbg !11 @@ -44,6 +47,8 @@ fn And() -> bool { // CHECK:STDOUT: ret i1 %0, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/operators/and_empty_block.carbon b/toolchain/lower/testdata/operators/and_empty_block.carbon index b1e3e33fe6b23..aedd893628e60 100644 --- a/toolchain/lower/testdata/operators/and_empty_block.carbon +++ b/toolchain/lower/testdata/operators/and_empty_block.carbon @@ -19,7 +19,8 @@ fn And(b: bool, c: bool) -> bool { // CHECK:STDOUT: ; ModuleID = 'and_empty_block.carbon' // CHECK:STDOUT: source_filename = "and_empty_block.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CAnd.Main(i1 %b, i1 %c) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CAnd.Main(i1 %b, i1 %c) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: br i1 %b, label %and.rhs, label %and.result, !dbg !7 // CHECK:STDOUT: @@ -31,6 +32,8 @@ fn And(b: bool, c: bool) -> bool { // CHECK:STDOUT: ret i1 %0, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/operators/arithmetic.carbon b/toolchain/lower/testdata/operators/arithmetic.carbon index 69649d76e7fd3..bdbba78723e7d 100644 --- a/toolchain/lower/testdata/operators/arithmetic.carbon +++ b/toolchain/lower/testdata/operators/arithmetic.carbon @@ -39,90 +39,106 @@ fn div_u16(a: u16, b: u16) -> u16 { return a / b; } // CHECK:STDOUT: ; ModuleID = 'arithmetic.carbon' // CHECK:STDOUT: source_filename = "arithmetic.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_Cadd_i32.Main(i32 %a, i32 %b) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_Cadd_i32.Main(i32 %a, i32 %b) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.AddWith.impl.Op.call = add i32 %a, %b, !dbg !7 // CHECK:STDOUT: ret i32 %Int.as.AddWith.impl.Op.call, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_Cadd_u32.Main(i32 %a, i32 %b) !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_Cadd_u32.Main(i32 %a, i32 %b) #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %UInt.as.AddWith.impl.Op.call = add i32 %a, %b, !dbg !10 // CHECK:STDOUT: ret i32 %UInt.as.AddWith.impl.Op.call, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_Cdiv_i32.Main(i32 %a, i32 %b) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_Cdiv_i32.Main(i32 %a, i32 %b) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.DivWith.impl.Op.call = sdiv i32 %a, %b, !dbg !13 // CHECK:STDOUT: ret i32 %Int.as.DivWith.impl.Op.call, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_Cdiv_u32.Main(i32 %a, i32 %b) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_Cdiv_u32.Main(i32 %a, i32 %b) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %UInt.as.DivWith.impl.Op.call = udiv i32 %a, %b, !dbg !16 // CHECK:STDOUT: ret i32 %UInt.as.DivWith.impl.Op.call, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_Cmod_i32.Main(i32 %a, i32 %b) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_Cmod_i32.Main(i32 %a, i32 %b) #0 !dbg !18 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.ModWith.impl.Op.call = srem i32 %a, %b, !dbg !19 // CHECK:STDOUT: ret i32 %Int.as.ModWith.impl.Op.call, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_Cmod_u32.Main(i32 %a, i32 %b) !dbg !21 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_Cmod_u32.Main(i32 %a, i32 %b) #0 !dbg !21 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %UInt.as.ModWith.impl.Op.call = urem i32 %a, %b, !dbg !22 // CHECK:STDOUT: ret i32 %UInt.as.ModWith.impl.Op.call, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_Cmul_i32.Main(i32 %a, i32 %b) !dbg !24 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_Cmul_i32.Main(i32 %a, i32 %b) #0 !dbg !24 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.MulWith.impl.Op.call = mul i32 %a, %b, !dbg !25 // CHECK:STDOUT: ret i32 %Int.as.MulWith.impl.Op.call, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_Cmul_u32.Main(i32 %a, i32 %b) !dbg !27 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_Cmul_u32.Main(i32 %a, i32 %b) #0 !dbg !27 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %UInt.as.MulWith.impl.Op.call = mul i32 %a, %b, !dbg !28 // CHECK:STDOUT: ret i32 %UInt.as.MulWith.impl.Op.call, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_Cneg_i32.Main(i32 %a) !dbg !30 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_Cneg_i32.Main(i32 %a) #0 !dbg !30 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.Negate.impl.Op.call = sub i32 0, %a, !dbg !31 // CHECK:STDOUT: ret i32 %Int.as.Negate.impl.Op.call, !dbg !32 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_Cneg_u32.Main(i32 %a) !dbg !33 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_Cneg_u32.Main(i32 %a) #0 !dbg !33 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %UInt.as.Negate.impl.Op.call = sub i32 0, %a, !dbg !34 // CHECK:STDOUT: ret i32 %UInt.as.Negate.impl.Op.call, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_Csub_i32.Main(i32 %a, i32 %b) !dbg !36 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_Csub_i32.Main(i32 %a, i32 %b) #0 !dbg !36 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.SubWith.impl.Op.call = sub i32 %a, %b, !dbg !37 // CHECK:STDOUT: ret i32 %Int.as.SubWith.impl.Op.call, !dbg !38 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_Csub_u32.Main(i32 %a, i32 %b) !dbg !39 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_Csub_u32.Main(i32 %a, i32 %b) #0 !dbg !39 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %UInt.as.SubWith.impl.Op.call = sub i32 %a, %b, !dbg !40 // CHECK:STDOUT: ret i32 %UInt.as.SubWith.impl.Op.call, !dbg !41 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @_Cdiv_i16.Main(i16 %a, i16 %b) !dbg !42 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_Cdiv_i16.Main(i16 %a, i16 %b) #0 !dbg !42 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Int.as.DivWith.impl.Op.call = sdiv i16 %a, %b, !dbg !43 // CHECK:STDOUT: ret i16 %Int.as.DivWith.impl.Op.call, !dbg !44 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @_Cdiv_u16.Main(i16 %a, i16 %b) !dbg !45 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_Cdiv_u16.Main(i16 %a, i16 %b) #0 !dbg !45 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %UInt.as.DivWith.impl.Op.call = udiv i16 %a, %b, !dbg !46 // CHECK:STDOUT: ret i16 %UInt.as.DivWith.impl.Op.call, !dbg !47 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/operators/assignment.carbon b/toolchain/lower/testdata/operators/assignment.carbon index ec6a6855a1ef3..eab7750f21cef 100644 --- a/toolchain/lower/testdata/operators/assignment.carbon +++ b/toolchain/lower/testdata/operators/assignment.carbon @@ -22,7 +22,8 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: @tuple.loc17_5 = internal constant { i32, i32 } { i32 1, i32 2 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca i32, align 4, !dbg !7 // CHECK:STDOUT: %b.var = alloca { i32, i32 }, align 8, !dbg !8 @@ -37,16 +38,17 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/operators/increment.carbon b/toolchain/lower/testdata/operators/increment.carbon index c3e10c2758aef..c76eb338ebe49 100644 --- a/toolchain/lower/testdata/operators/increment.carbon +++ b/toolchain/lower/testdata/operators/increment.carbon @@ -22,7 +22,8 @@ fn IncrSigned() { // CHECK:STDOUT: ; ModuleID = 'increment.carbon' // CHECK:STDOUT: source_filename = "increment.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CIncrSigned.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CIncrSigned.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %from.var = alloca i32, align 4, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %from.var), !dbg !7 @@ -32,14 +33,16 @@ fn IncrSigned() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_COp.Int.Core:Inc.Core.be1e879c1ad406d8"(ptr %self) !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_COp.Int.Core:Inc.Core.be1e879c1ad406d8"(ptr %self) #0 !dbg !10 { // CHECK:STDOUT: call void @"_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e"(ptr %self, i32 1), !dbg !12 // CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e"(ptr %self, i32 %other) !dbg !14 { +// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind +// CHECK:STDOUT: define linkonce_odr void @"_COp:thunk.Int.Core:AddAssignWith.Core.5dfb78ae56583d8e"(ptr %self, i32 %other) #2 !dbg !14 { // CHECK:STDOUT: %1 = call i32 @"_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899"(i32 %other), !dbg !15 // CHECK:STDOUT: %2 = load i32, ptr %self, align 4, !dbg !16 // CHECK:STDOUT: %3 = add i32 %2, %1, !dbg !16 @@ -47,11 +50,14 @@ fn IncrSigned() { // CHECK:STDOUT: ret void, !dbg !16 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i32 @"_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899"(i32 %self) !dbg !17 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @"_CConvert.225258f1a45e9386:ImplicitAs.Core.5450dc8e8b8e0899"(i32 %self) #0 !dbg !17 { // CHECK:STDOUT: ret i32 %self, !dbg !19 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { alwaysinline nounwind } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/operators/not.carbon b/toolchain/lower/testdata/operators/not.carbon index 9d8a85a75be05..176d190f91094 100644 --- a/toolchain/lower/testdata/operators/not.carbon +++ b/toolchain/lower/testdata/operators/not.carbon @@ -17,12 +17,15 @@ fn Not(b: bool) -> bool { // CHECK:STDOUT: ; ModuleID = 'not.carbon' // CHECK:STDOUT: source_filename = "not.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CNot.Main(i1 %b) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CNot.Main(i1 %b) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc14 = xor i1 %b, true, !dbg !7 // CHECK:STDOUT: ret i1 %.loc14, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/operators/or.carbon b/toolchain/lower/testdata/operators/or.carbon index 599c55dbcc71e..cda256a9dda91 100644 --- a/toolchain/lower/testdata/operators/or.carbon +++ b/toolchain/lower/testdata/operators/or.carbon @@ -20,17 +20,20 @@ fn Or() -> bool { // CHECK:STDOUT: ; ModuleID = 'or.carbon' // CHECK:STDOUT: source_filename = "or.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i1 true, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CG.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CG.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i1 true, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_COr.Main() !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_COr.Main() #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %F.call = call i1 @_CF.Main(), !dbg !11 // CHECK:STDOUT: %.loc17_14.3 = xor i1 %F.call, true, !dbg !11 @@ -45,6 +48,8 @@ fn Or() -> bool { // CHECK:STDOUT: ret i1 %0, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/operators/or_empty_block.carbon b/toolchain/lower/testdata/operators/or_empty_block.carbon index 62b8f47ccb57d..d37b89db0c54c 100644 --- a/toolchain/lower/testdata/operators/or_empty_block.carbon +++ b/toolchain/lower/testdata/operators/or_empty_block.carbon @@ -19,7 +19,8 @@ fn Or(b: bool, c: bool) -> bool { // CHECK:STDOUT: ; ModuleID = 'or_empty_block.carbon' // CHECK:STDOUT: source_filename = "or_empty_block.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_COr.Main(i1 %b, i1 %c) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_COr.Main(i1 %b, i1 %c) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc16_12.1 = xor i1 %b, true, !dbg !7 // CHECK:STDOUT: br i1 %.loc16_12.1, label %or.rhs, label %or.result, !dbg !7 @@ -32,6 +33,8 @@ fn Or(b: bool, c: bool) -> bool { // CHECK:STDOUT: ret i1 %0, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/operators/overloaded.carbon b/toolchain/lower/testdata/operators/overloaded.carbon index af0c4c66e2dff..a5b83f49efa23 100644 --- a/toolchain/lower/testdata/operators/overloaded.carbon +++ b/toolchain/lower/testdata/operators/overloaded.carbon @@ -33,7 +33,8 @@ fn Calculate(a: Number, b: Number) -> Number { // CHECK:STDOUT: ; ModuleID = 'overloaded.carbon' // CHECK:STDOUT: source_filename = "overloaded.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_COp.Number.Main:Negate.Core"(ptr sret({ i1 }) %return, ptr %self) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_COp.Number.Main:Negate.Core"(ptr sret({ i1 }) %return, ptr %self) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc19_36.1.is_positive = getelementptr inbounds nuw { i1 }, ptr %self, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %.loc19_36.2 = load i8, ptr %.loc19_36.1.is_positive, align 1, !dbg !7 @@ -45,7 +46,8 @@ fn Calculate(a: Number, b: Number) -> Number { // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @"_COp.Number.Main:MulWith.Core"(ptr sret({ i1 }) %return, ptr %self, ptr %other) !dbg !11 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @"_COp.Number.Main:MulWith.Core"(ptr sret({ i1 }) %return, ptr %self, ptr %other) #0 !dbg !11 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc24_33.1.is_positive = getelementptr inbounds nuw { i1 }, ptr %self, i32 0, i32 0, !dbg !12 // CHECK:STDOUT: %.loc24_33.2 = load i8, ptr %.loc24_33.1.is_positive, align 1, !dbg !12 @@ -89,7 +91,8 @@ fn Calculate(a: Number, b: Number) -> Number { // CHECK:STDOUT: ret void, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CCalculate.Main(ptr sret({ i1 }) %return, ptr %a, ptr %b) !dbg !21 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CCalculate.Main(ptr sret({ i1 }) %return, ptr %a, ptr %b) #0 !dbg !21 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc30_10.1.temp = alloca { i1 }, align 8, !dbg !22 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc30_10.1.temp), !dbg !22 @@ -99,9 +102,10 @@ fn Calculate(a: Number, b: Number) -> Number { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/packages/cross_package_call.carbon b/toolchain/lower/testdata/packages/cross_package_call.carbon index 8dd1a092ea7ad..13734156e45d1 100644 --- a/toolchain/lower/testdata/packages/cross_package_call.carbon +++ b/toolchain/lower/testdata/packages/cross_package_call.carbon @@ -30,16 +30,20 @@ fn G() -> i32 { return A.NS.G(1); } // CHECK:STDOUT: ; ModuleID = 'a.carbon' // CHECK:STDOUT: source_filename = "a.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.NS.A() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.NS.A() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CG.NS.A(i32 %x) !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CG.NS.A(i32 %x) #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 %x, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -56,7 +60,8 @@ fn G() -> i32 { return A.NS.G(1); } // CHECK:STDOUT: ; ModuleID = 'b.carbon' // CHECK:STDOUT: source_filename = "b.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CF.NS.A(), !dbg !7 // CHECK:STDOUT: ret void, !dbg !8 @@ -64,7 +69,8 @@ fn G() -> i32 { return A.NS.G(1); } // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CF.NS.A() // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CG.Main() !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CG.Main() #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %G.call = call i32 @_CG.NS.A(i32 1), !dbg !10 // CHECK:STDOUT: ret i32 %G.call, !dbg !11 @@ -72,6 +78,8 @@ fn G() -> i32 { return A.NS.G(1); } // CHECK:STDOUT: // CHECK:STDOUT: declare i32 @_CG.NS.A(i32) // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/pointer/address_of_field.carbon b/toolchain/lower/testdata/pointer/address_of_field.carbon index 033e85fe53d62..81330abbbad98 100644 --- a/toolchain/lower/testdata/pointer/address_of_field.carbon +++ b/toolchain/lower/testdata/pointer/address_of_field.carbon @@ -24,7 +24,8 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CG.Main(ptr) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %s.var = alloca { i32, i32 }, align 8, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %s.var), !dbg !7 @@ -37,13 +38,14 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/pointer/address_of_unused.carbon b/toolchain/lower/testdata/pointer/address_of_unused.carbon index 1e74d9c420f26..5552bc3ac3288 100644 --- a/toolchain/lower/testdata/pointer/address_of_unused.carbon +++ b/toolchain/lower/testdata/pointer/address_of_unused.carbon @@ -18,7 +18,8 @@ fn F() { // CHECK:STDOUT: ; ModuleID = 'address_of_unused.carbon' // CHECK:STDOUT: source_filename = "address_of_unused.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %n.var), !dbg !7 @@ -27,9 +28,10 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/pointer/basic.carbon b/toolchain/lower/testdata/pointer/basic.carbon index 5083056841150..9572daa6738e6 100644 --- a/toolchain/lower/testdata/pointer/basic.carbon +++ b/toolchain/lower/testdata/pointer/basic.carbon @@ -22,13 +22,15 @@ fn F() -> i32 { // CHECK:STDOUT: ; ModuleID = 'basic.carbon' // CHECK:STDOUT: source_filename = "basic.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CG.Main(ptr %p) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CG.Main(ptr %p) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc14_10.2 = load i32, ptr %p, align 4, !dbg !7 // CHECK:STDOUT: ret i32 %.loc14_10.2, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CF.Main() !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CF.Main() #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !10 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %n.var), !dbg !10 @@ -38,9 +40,10 @@ fn F() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/pointer/pointer_to_pointer.carbon b/toolchain/lower/testdata/pointer/pointer_to_pointer.carbon index 42f32153c4404..ec50850b01319 100644 --- a/toolchain/lower/testdata/pointer/pointer_to_pointer.carbon +++ b/toolchain/lower/testdata/pointer/pointer_to_pointer.carbon @@ -20,7 +20,8 @@ fn F(p: i32**) -> i32 { // CHECK:STDOUT: ; ModuleID = 'pointer_to_pointer.carbon' // CHECK:STDOUT: source_filename = "pointer_to_pointer.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CF.Main(ptr %p) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CF.Main(ptr %p) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca ptr, align 8, !dbg !7 // CHECK:STDOUT: %b.var = alloca ptr, align 8, !dbg !8 @@ -39,12 +40,13 @@ fn F(p: i32**) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/primitives/bool.carbon b/toolchain/lower/testdata/primitives/bool.carbon index e742078ab5aa9..c0478f33c29e7 100644 --- a/toolchain/lower/testdata/primitives/bool.carbon +++ b/toolchain/lower/testdata/primitives/bool.carbon @@ -27,17 +27,20 @@ fn LoadStore(p: bool*, b: bool) -> bool { // CHECK:STDOUT: ; ModuleID = 'bool.carbon' // CHECK:STDOUT: source_filename = "bool.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i1 false, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CT.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CT.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i1 true, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i1 @_CLoadStore.Main(ptr %p, i1 %b) !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i1 @_CLoadStore.Main(ptr %p, i1 %b) #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc22_17.2 = load i8, ptr %p, align 1, !dbg !11 // CHECK:STDOUT: %.loc22_17.21 = trunc i8 %.loc22_17.2 to i1, !dbg !11 @@ -46,6 +49,8 @@ fn LoadStore(p: bool*, b: bool) -> bool { // CHECK:STDOUT: ret i1 %.loc22_17.21, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/primitives/int_types.carbon b/toolchain/lower/testdata/primitives/int_types.carbon index b1e3a83e890cb..65309db787efb 100644 --- a/toolchain/lower/testdata/primitives/int_types.carbon +++ b/toolchain/lower/testdata/primitives/int_types.carbon @@ -30,34 +30,40 @@ fn LoadStore_NotBytes(p: Core.Int(13)*, n: Core.Int(13)) -> Core.Int(13) { // CHECK:STDOUT: ; ModuleID = 'int_types.carbon' // CHECK:STDOUT: source_filename = "int_types.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i8 @_CF_i8.Main(i8 %a) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i8 @_CF_i8.Main(i8 %a) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i8 %a, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i16 @_CF_u16.Main(i16 %a) !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_CF_u16.Main(i16 %a) #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i16 %a, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i64 @_CF_i64.Main(i64 %a) !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i64 @_CF_i64.Main(i64 %a) #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i64 %a, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i65536 @_CF_u65536.Main(i65536 %a) !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i65536 @_CF_u65536.Main(i65536 %a) #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i65536 %a, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i24 @_CLoadStore_Bytes.Main(ptr %p, i24 %n) !dbg !14 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i24 @_CLoadStore_Bytes.Main(ptr %p, i24 %n) #0 !dbg !14 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc19_25.2 = load i24, ptr %p, align 4, !dbg !15 // CHECK:STDOUT: store i24 %n, ptr %p, align 4, !dbg !16 // CHECK:STDOUT: ret i24 %.loc19_25.2, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i13 @_CLoadStore_NotBytes.Main(ptr %p, i13 %n) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i13 @_CLoadStore_NotBytes.Main(ptr %p, i13 %n) #0 !dbg !18 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc25_25.2 = load i16, ptr %p, align 2, !dbg !19 // CHECK:STDOUT: %.loc25_25.21 = trunc i16 %.loc25_25.2 to i13, !dbg !19 @@ -66,6 +72,8 @@ fn LoadStore_NotBytes(p: Core.Int(13)*, n: Core.Int(13)) -> Core.Int(13) { // CHECK:STDOUT: ret i13 %.loc25_25.21, !dbg !21 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/primitives/numeric_literals.carbon b/toolchain/lower/testdata/primitives/numeric_literals.carbon index 519aa3eb9da00..380fd28df69d1 100644 --- a/toolchain/lower/testdata/primitives/numeric_literals.carbon +++ b/toolchain/lower/testdata/primitives/numeric_literals.carbon @@ -35,7 +35,8 @@ fn F() { // CHECK:STDOUT: @array.712.loc16_3 = internal constant [4 x i32] [i32 8, i32 9, i32 8, i32 8] // CHECK:STDOUT: @array.6e0.loc22_3 = internal constant [6 x double] [double 9.000000e-01, double 8.000000e+00, double 8.000000e+01, double 1.000000e+07, double 1.000000e+08, double 1.000000e-08] // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ints.var = alloca [4 x i32], align 4, !dbg !7 // CHECK:STDOUT: %floats.var = alloca [6 x double], align 8, !dbg !8 @@ -57,17 +58,18 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/primitives/optional.carbon b/toolchain/lower/testdata/primitives/optional.carbon index 8216e6f9e2389..8bce884554486 100644 --- a/toolchain/lower/testdata/primitives/optional.carbon +++ b/toolchain/lower/testdata/primitives/optional.carbon @@ -23,7 +23,8 @@ fn Convert(o: Core.Optional(i32*)) -> Core.Optional(i32) { // CHECK:STDOUT: ; ModuleID = 'optional.carbon' // CHECK:STDOUT: source_filename = "optional.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CConvert.Main(ptr sret({ i32, i1 }) %return, ptr %o) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CConvert.Main(ptr sret({ i32, i1 }) %return, ptr %o) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc18_20.1.temp = alloca { i32, i1 }, align 8, !dbg !7 // CHECK:STDOUT: %Optional.HasValue.call = call i1 @_CHasValue.Optional.Core.217efae529e578bc(ptr %o), !dbg !8 @@ -41,47 +42,55 @@ fn Convert(o: Core.Optional(i32*)) -> Core.Optional(i32) { // CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr i1 @_CHasValue.Optional.Core.217efae529e578bc(ptr %self) !dbg !14 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i1 @_CHasValue.Optional.Core.217efae529e578bc(ptr %self) #0 !dbg !14 { // CHECK:STDOUT: %1 = load ptr, ptr %self, align 8, !dbg !16 // CHECK:STDOUT: %2 = icmp eq ptr %1, null, !dbg !16 // CHECK:STDOUT: ret i1 %2, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @_CGet.Optional.Core.217efae529e578bc(ptr %self) !dbg !18 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @_CGet.Optional.Core.217efae529e578bc(ptr %self) #0 !dbg !18 { // CHECK:STDOUT: %1 = call ptr @"_CGet.4f0b5cc38af595d2:OptionalStorage.Core.b88d1103f417c6d4"(ptr %self), !dbg !19 // CHECK:STDOUT: ret ptr %1, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CConvert.8d16edc1dfe20a7c:ImplicitAs.Core.f16306f3d30b9711"(ptr sret({ i32, i1 }) %return, i32 %self) !dbg !21 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CConvert.8d16edc1dfe20a7c:ImplicitAs.Core.f16306f3d30b9711"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !21 { // CHECK:STDOUT: call void @_CSome.Optional.Core.f16306f3d30b9711(ptr %return, i32 %self), !dbg !22 // CHECK:STDOUT: ret void, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CNone.Optional.Core.f16306f3d30b9711(ptr sret({ i32, i1 }) %return) !dbg !24 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CNone.Optional.Core.f16306f3d30b9711(ptr sret({ i32, i1 }) %return) #0 !dbg !24 { // CHECK:STDOUT: call void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %return), !dbg !25 // CHECK:STDOUT: ret void, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr ptr @"_CGet.4f0b5cc38af595d2:OptionalStorage.Core.b88d1103f417c6d4"(ptr %value) !dbg !27 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr ptr @"_CGet.4f0b5cc38af595d2:OptionalStorage.Core.b88d1103f417c6d4"(ptr %value) #0 !dbg !27 { // CHECK:STDOUT: %1 = load ptr, ptr %value, align 8, !dbg !28 // CHECK:STDOUT: ret ptr %1, !dbg !29 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @_CSome.Optional.Core.f16306f3d30b9711(ptr sret({ i32, i1 }) %return, i32 %value) !dbg !30 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @_CSome.Optional.Core.f16306f3d30b9711(ptr sret({ i32, i1 }) %return, i32 %value) #0 !dbg !30 { // CHECK:STDOUT: call void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %return, i32 %value), !dbg !31 // CHECK:STDOUT: ret void, !dbg !32 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return) !dbg !33 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return) #0 !dbg !33 { // CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 1, !dbg !34 // CHECK:STDOUT: store i8 0, ptr %has_value, align 1, !dbg !34 // CHECK:STDOUT: ret void, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define linkonce_odr void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return, i32 %self) !dbg !36 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !36 { // CHECK:STDOUT: %value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 0, !dbg !37 // CHECK:STDOUT: store i32 %self, ptr %value, align 4, !dbg !37 // CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 1, !dbg !38 @@ -89,7 +98,8 @@ fn Convert(o: Core.Optional(i32*)) -> Core.Optional(i32) { // CHECK:STDOUT: ret void, !dbg !39 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/primitives/string.carbon b/toolchain/lower/testdata/primitives/string.carbon index 0037d91f86d7e..cd61ec64bd744 100644 --- a/toolchain/lower/testdata/primitives/string.carbon +++ b/toolchain/lower/testdata/primitives/string.carbon @@ -45,25 +45,29 @@ fn Copy(s: str) -> str { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CF.Main(ptr) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CG.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CG.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CF.Main(ptr @String.val.13d.String.val), !dbg !7 // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CH.Main() !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CH.Main() #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CF.Main(ptr @String.val.13d.String.val), !dbg !10 // CHECK:STDOUT: ret void, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CI.Main() !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CI.Main() #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CF.Main(ptr @String.val.afc.String.val), !dbg !13 // CHECK:STDOUT: ret void, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CCopy.Main(ptr sret({ ptr, i64 }) %return, ptr %s) !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CCopy.Main(ptr sret({ ptr, i64 }) %return, ptr %s) #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @"_COp.String.Core:Copy.Core"(ptr %return, ptr %s), !dbg !16 // CHECK:STDOUT: ret void, !dbg !17 @@ -71,6 +75,8 @@ fn Copy(s: str) -> str { // CHECK:STDOUT: // CHECK:STDOUT: declare void @"_COp.String.Core:Copy.Core"(ptr sret({ ptr, i64 }), ptr) // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/primitives/type_values.carbon b/toolchain/lower/testdata/primitives/type_values.carbon index 854e03b43c938..14811c7f541b2 100644 --- a/toolchain/lower/testdata/primitives/type_values.carbon +++ b/toolchain/lower/testdata/primitives/type_values.carbon @@ -30,21 +30,26 @@ fn F64() -> type { // CHECK:STDOUT: // CHECK:STDOUT: %type = type {} // CHECK:STDOUT: -// CHECK:STDOUT: define %type @_CI32.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define %type @_CI32.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret %type zeroinitializer, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define %type @_CI48.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define %type @_CI48.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret %type zeroinitializer, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define %type @_CF64.Main() !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define %type @_CF64.Main() #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret %type zeroinitializer, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/primitives/zero.carbon b/toolchain/lower/testdata/primitives/zero.carbon index 9ab326685b146..adc035fbb0929 100644 --- a/toolchain/lower/testdata/primitives/zero.carbon +++ b/toolchain/lower/testdata/primitives/zero.carbon @@ -17,11 +17,14 @@ fn Main() -> i32 { // CHECK:STDOUT: ; ModuleID = 'zero.carbon' // CHECK:STDOUT: source_filename = "zero.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CMain.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CMain.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 0, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/return/code_after_return.carbon b/toolchain/lower/testdata/return/code_after_return.carbon index d638c96457b1b..29dfa74a3126e 100644 --- a/toolchain/lower/testdata/return/code_after_return.carbon +++ b/toolchain/lower/testdata/return/code_after_return.carbon @@ -20,16 +20,20 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'code_after_return.carbon' // CHECK:STDOUT: source_filename = "code_after_return.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/return/no_value.carbon b/toolchain/lower/testdata/return/no_value.carbon index 9ec797881e3ff..c56fff69d3d4d 100644 --- a/toolchain/lower/testdata/return/no_value.carbon +++ b/toolchain/lower/testdata/return/no_value.carbon @@ -17,11 +17,14 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'no_value.carbon' // CHECK:STDOUT: source_filename = "no_value.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMain.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/return/return_var.carbon b/toolchain/lower/testdata/return/return_var.carbon index d2f78548488e9..289b196d8be87 100644 --- a/toolchain/lower/testdata/return/return_var.carbon +++ b/toolchain/lower/testdata/return/return_var.carbon @@ -24,7 +24,8 @@ fn Make() -> C { // CHECK:STDOUT: ; ModuleID = 'return_var.carbon' // CHECK:STDOUT: source_filename = "return_var.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMake.Main(ptr sret({ i32, ptr }) %return) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMake.Main(ptr sret({ i32, ptr }) %return) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc20_30.3.data = getelementptr inbounds nuw { i32, ptr }, ptr %return, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %.loc20_30.5.next = getelementptr inbounds nuw { i32, ptr }, ptr %return, i32 0, i32 1, !dbg !7 @@ -33,6 +34,8 @@ fn Make() -> C { // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/return/return_var_byval.carbon b/toolchain/lower/testdata/return/return_var_byval.carbon index 335ade43e1a20..e47ae9054fe21 100644 --- a/toolchain/lower/testdata/return/return_var_byval.carbon +++ b/toolchain/lower/testdata/return/return_var_byval.carbon @@ -18,7 +18,8 @@ fn Main() -> i32 { // CHECK:STDOUT: ; ModuleID = 'return_var_byval.carbon' // CHECK:STDOUT: source_filename = "return_var_byval.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CMain.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CMain.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca i32, align 4, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %x.var), !dbg !7 @@ -28,9 +29,10 @@ fn Main() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/return/value.carbon b/toolchain/lower/testdata/return/value.carbon index e2818f2397b0a..31d4cc0246315 100644 --- a/toolchain/lower/testdata/return/value.carbon +++ b/toolchain/lower/testdata/return/value.carbon @@ -17,11 +17,14 @@ fn Main() -> i32 { // CHECK:STDOUT: ; ModuleID = 'value.carbon' // CHECK:STDOUT: source_filename = "value.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CMain.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CMain.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 0, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/return/var.carbon b/toolchain/lower/testdata/return/var.carbon index e4ec65bd53c70..82356a66548bc 100644 --- a/toolchain/lower/testdata/return/var.carbon +++ b/toolchain/lower/testdata/return/var.carbon @@ -18,7 +18,8 @@ fn Main() -> i32 { // CHECK:STDOUT: ; ModuleID = 'var.carbon' // CHECK:STDOUT: source_filename = "var.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CMain.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CMain.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca i32, align 4, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %x.var), !dbg !7 @@ -28,9 +29,10 @@ fn Main() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/struct/empty.carbon b/toolchain/lower/testdata/struct/empty.carbon index a1ff8981ca3ca..78e2dd3df16b8 100644 --- a/toolchain/lower/testdata/struct/empty.carbon +++ b/toolchain/lower/testdata/struct/empty.carbon @@ -19,7 +19,8 @@ fn Run() -> i32 { // CHECK:STDOUT: ; ModuleID = 'empty.carbon' // CHECK:STDOUT: source_filename = "empty.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca {}, align 8, !dbg !7 // CHECK:STDOUT: %y.var = alloca {}, align 8, !dbg !8 @@ -29,12 +30,13 @@ fn Run() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/struct/member_access.carbon b/toolchain/lower/testdata/struct/member_access.carbon index d2026b1f6270b..18633c2679da1 100644 --- a/toolchain/lower/testdata/struct/member_access.carbon +++ b/toolchain/lower/testdata/struct/member_access.carbon @@ -22,7 +22,8 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: @struct.loc14_3 = internal constant { double, i32 } { double 0.000000e+00, i32 1 } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca { double, i32 }, align 8, !dbg !7 // CHECK:STDOUT: %y.var = alloca i32, align 4, !dbg !8 @@ -42,16 +43,17 @@ fn Run() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/struct/nested_struct.carbon b/toolchain/lower/testdata/struct/nested_struct.carbon index 51a76d5424eee..8e52a18b6ba32 100644 --- a/toolchain/lower/testdata/struct/nested_struct.carbon +++ b/toolchain/lower/testdata/struct/nested_struct.carbon @@ -18,11 +18,14 @@ fn Run() -> i32 { // CHECK:STDOUT: ; ModuleID = 'nested_struct.carbon' // CHECK:STDOUT: source_filename = "nested_struct.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 0, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/struct/nested_struct_in_place.carbon b/toolchain/lower/testdata/struct/nested_struct_in_place.carbon index f32cb56fd35cd..0ad36f7def99c 100644 --- a/toolchain/lower/testdata/struct/nested_struct_in_place.carbon +++ b/toolchain/lower/testdata/struct/nested_struct_in_place.carbon @@ -21,7 +21,8 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CF.Main(ptr sret({ i32, i32, i32 })) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CG.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CG.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %v.var = alloca { { i32, i32, i32 }, { i32, i32, i32 } }, align 8, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %v.var), !dbg !7 @@ -33,9 +34,10 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/struct/one_entry.carbon b/toolchain/lower/testdata/struct/one_entry.carbon index 941840a79f6bd..b677772ccf7c9 100644 --- a/toolchain/lower/testdata/struct/one_entry.carbon +++ b/toolchain/lower/testdata/struct/one_entry.carbon @@ -19,7 +19,8 @@ fn Run() -> i32 { // CHECK:STDOUT: ; ModuleID = 'one_entry.carbon' // CHECK:STDOUT: source_filename = "one_entry.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca { i32 }, align 8, !dbg !7 // CHECK:STDOUT: %y.var = alloca { i32 }, align 8, !dbg !8 @@ -34,12 +35,13 @@ fn Run() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/struct/partially_const.carbon b/toolchain/lower/testdata/struct/partially_const.carbon index b10bf7ac6c2ea..d9f4aaab379db 100644 --- a/toolchain/lower/testdata/struct/partially_const.carbon +++ b/toolchain/lower/testdata/struct/partially_const.carbon @@ -17,7 +17,8 @@ fn Make(n: i32) -> {.a: i32, .b: i32, .c: i32} { // CHECK:STDOUT: ; ModuleID = 'partially_const.carbon' // CHECK:STDOUT: source_filename = "partially_const.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CMake.Main(ptr sret({ i32, i32, i32 }) %return, i32 %n) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMake.Main(ptr sret({ i32, i32, i32 }) %return, i32 %n) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc14_33.3.a = getelementptr inbounds nuw { i32, i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %.loc14_33.5.b = getelementptr inbounds nuw { i32, i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7 @@ -28,6 +29,8 @@ fn Make(n: i32) -> {.a: i32, .b: i32, .c: i32} { // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/struct/two_entries.carbon b/toolchain/lower/testdata/struct/two_entries.carbon index 992dcab0ba6de..b9c54c5b94eac 100644 --- a/toolchain/lower/testdata/struct/two_entries.carbon +++ b/toolchain/lower/testdata/struct/two_entries.carbon @@ -21,7 +21,8 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: @struct.loc14_3 = internal constant { i32, i32 } { i32 1, i32 2 } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca { i32, i32 }, align 8, !dbg !7 // CHECK:STDOUT: %y.var = alloca { i32, i32 }, align 8, !dbg !8 @@ -42,16 +43,17 @@ fn Run() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/tuple/access/element_access.carbon b/toolchain/lower/testdata/tuple/access/element_access.carbon index 19fcbadd16410..ef6854a53b04e 100644 --- a/toolchain/lower/testdata/tuple/access/element_access.carbon +++ b/toolchain/lower/testdata/tuple/access/element_access.carbon @@ -22,7 +22,8 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: @tuple.loc14_3 = internal constant { i32, i32, i32 } { i32 0, i32 1, i32 2 } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca { i32, i32, i32 }, align 8, !dbg !7 // CHECK:STDOUT: %b.var = alloca i32, align 4, !dbg !8 @@ -44,16 +45,17 @@ fn Run() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/tuple/access/return_value_access.carbon b/toolchain/lower/testdata/tuple/access/return_value_access.carbon index 22acde90af163..ab444df0d3ffb 100644 --- a/toolchain/lower/testdata/tuple/access/return_value_access.carbon +++ b/toolchain/lower/testdata/tuple/access/return_value_access.carbon @@ -21,7 +21,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: @tuple.loc13_39 = internal constant { i32, i32 } { i32 12, i32 24 } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main(ptr sret({ i32, i32 }) %return) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main(ptr sret({ i32, i32 }) %return) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %tuple.elem0.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7 // CHECK:STDOUT: %tuple.elem1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7 @@ -29,7 +30,8 @@ fn Run() { // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @main() !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @main() #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %t.var = alloca i32, align 4, !dbg !10 // CHECK:STDOUT: %.loc16_18.1.temp = alloca { i32, i32 }, align 8, !dbg !11 @@ -43,16 +45,17 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/tuple/empty.carbon b/toolchain/lower/testdata/tuple/empty.carbon index ffb47db7d17ab..f2a311f44510b 100644 --- a/toolchain/lower/testdata/tuple/empty.carbon +++ b/toolchain/lower/testdata/tuple/empty.carbon @@ -19,7 +19,8 @@ fn Run() -> i32 { // CHECK:STDOUT: ; ModuleID = 'empty.carbon' // CHECK:STDOUT: source_filename = "empty.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca {}, align 8, !dbg !7 // CHECK:STDOUT: %y.var = alloca {}, align 8, !dbg !8 @@ -29,12 +30,13 @@ fn Run() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/tuple/nested_tuple.carbon b/toolchain/lower/testdata/tuple/nested_tuple.carbon index f7c314349a918..bc6cdedbb04d5 100644 --- a/toolchain/lower/testdata/tuple/nested_tuple.carbon +++ b/toolchain/lower/testdata/tuple/nested_tuple.carbon @@ -18,11 +18,14 @@ fn Run() -> i32 { // CHECK:STDOUT: ; ModuleID = 'nested_tuple.carbon' // CHECK:STDOUT: source_filename = "nested_tuple.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret i32 0, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon b/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon index b7826f516d810..ee7c8cdfa687e 100644 --- a/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon +++ b/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon @@ -21,7 +21,8 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CF.Main(ptr sret({ i32, i32, i32 })) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CG.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CG.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %v.var = alloca { { i32, i32, i32 }, { i32, i32, i32 } }, align 8, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %v.var), !dbg !7 @@ -33,9 +34,10 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/tuple/one_entry.carbon b/toolchain/lower/testdata/tuple/one_entry.carbon index 3484755a148e1..93855bbc1b1fd 100644 --- a/toolchain/lower/testdata/tuple/one_entry.carbon +++ b/toolchain/lower/testdata/tuple/one_entry.carbon @@ -19,7 +19,8 @@ fn Run() -> i32 { // CHECK:STDOUT: ; ModuleID = 'one_entry.carbon' // CHECK:STDOUT: source_filename = "one_entry.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca { i32 }, align 8, !dbg !7 // CHECK:STDOUT: %y.var = alloca { i32 }, align 8, !dbg !8 @@ -34,12 +35,13 @@ fn Run() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/tuple/two_entries.carbon b/toolchain/lower/testdata/tuple/two_entries.carbon index 6b4922237b9d5..4b78e2d5e8cfe 100644 --- a/toolchain/lower/testdata/tuple/two_entries.carbon +++ b/toolchain/lower/testdata/tuple/two_entries.carbon @@ -21,7 +21,8 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: @tuple.loc14_3 = internal constant { i32, i32 } { i32 12, i32 7 } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca { i32, i32 }, align 8, !dbg !7 // CHECK:STDOUT: %y.var = alloca { i32, i32 }, align 8, !dbg !8 @@ -42,16 +43,17 @@ fn Run() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/tuple/value_formation.carbon b/toolchain/lower/testdata/tuple/value_formation.carbon index 80235c3c7fdbe..73c31ae74b828 100644 --- a/toolchain/lower/testdata/tuple/value_formation.carbon +++ b/toolchain/lower/testdata/tuple/value_formation.carbon @@ -23,7 +23,8 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CG.Main(ptr) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca { i32, i32, i32 }, align 8, !dbg !7 // CHECK:STDOUT: %b.var = alloca { i32, i32, i32 }, align 8, !dbg !8 @@ -65,12 +66,13 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/tuple/value_forwarding.carbon b/toolchain/lower/testdata/tuple/value_forwarding.carbon index 42b98c773dab2..929c3f15730e6 100644 --- a/toolchain/lower/testdata/tuple/value_forwarding.carbon +++ b/toolchain/lower/testdata/tuple/value_forwarding.carbon @@ -21,7 +21,8 @@ fn F(a: (i32, i32, i32), b: (i32, i32, i32)) { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CG.Main(ptr) // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CF.Main(ptr %a, ptr %b) !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main(ptr %a, ptr %b) #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %tuple = alloca { ptr, ptr }, align 8, !dbg !7 // CHECK:STDOUT: %tuple1 = getelementptr inbounds nuw { ptr, ptr }, ptr %tuple, i32 0, i32 0, !dbg !7 @@ -32,6 +33,8 @@ fn F(a: (i32, i32, i32), b: (i32, i32, i32)) { // CHECK:STDOUT: ret void, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/var/global.carbon b/toolchain/lower/testdata/var/global.carbon index d4c7abc3b8bb2..8fc48ccb2f1ad 100644 --- a/toolchain/lower/testdata/var/global.carbon +++ b/toolchain/lower/testdata/var/global.carbon @@ -50,17 +50,21 @@ var (_: i32, _: i32) = (3, 4); // CHECK:STDOUT: @_Ca.Main = global i32 0 // CHECK:STDOUT: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @_C__global_init.Main, ptr null }] // CHECK:STDOUT: -// CHECK:STDOUT: define ptr @_CGetA.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define ptr @_CGetA.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret ptr @_Ca.Main, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_C__global_init.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_C__global_init.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: store i32 1, ptr @_Ca.Main, align 4, !dbg !9 // CHECK:STDOUT: ret void, !dbg !10 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -82,23 +86,28 @@ var (_: i32, _: i32) = (3, 4); // CHECK:STDOUT: @_Cc.Main = global i32 0 // CHECK:STDOUT: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @_C__global_init.Main, ptr null }] // CHECK:STDOUT: -// CHECK:STDOUT: define ptr @_CGetB.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define ptr @_CGetB.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret ptr @_Cb.Main, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define ptr @_CGetC.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define ptr @_CGetC.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret ptr @_Cc.Main, !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_C__global_init.Main() !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_C__global_init.Main() #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: store i32 2, ptr @_Cb.Main, align 4, !dbg !11 // CHECK:STDOUT: store i32 3, ptr @_Cc.Main, align 4, !dbg !12 // CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -123,29 +132,33 @@ var (_: i32, _: i32) = (3, 4); // CHECK:STDOUT: @tuple.loc4_1 = internal constant { i32, i32 } { i32 4, i32 5 } // CHECK:STDOUT: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @_C__global_init.Main, ptr null }] // CHECK:STDOUT: -// CHECK:STDOUT: define ptr @_CGetD.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define ptr @_CGetD.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret ptr @_Cd.Main, !dbg !7 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define ptr @_CGetE.Main() !dbg !8 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define ptr @_CGetE.Main() #0 !dbg !8 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret ptr getelementptr inbounds nuw ({ i32, i32 }, ptr @_Cd.Main, i32 0, i32 1), !dbg !9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define void @_C__global_init.Main() !dbg !10 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_C__global_init.Main() #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 @_Cd.Main, ptr align 4 @tuple.loc4_1, i64 8, i1 false), !dbg !11 // CHECK:STDOUT: ret void, !dbg !12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @_Cd.Main, { 0, 2, 1 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -172,7 +185,8 @@ var (_: i32, _: i32) = (3, 4); // CHECK:STDOUT: @tuple.ffd.loc5_1 = internal constant { i32, i32 } { i32 3, i32 4 } // CHECK:STDOUT: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @_C__global_init.Main, ptr null }] // CHECK:STDOUT: -// CHECK:STDOUT: define void @_C__global_init.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_C__global_init.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 @_Cx.Main, ptr align 4 @tuple.21c.loc4_1, i64 8, i1 false), !dbg !7 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 @var.anon.var_patt.loc5, ptr align 4 @tuple.ffd.loc5_1, i64 8, i1 false), !dbg !8 @@ -180,12 +194,13 @@ var (_: i32, _: i32) = (3, 4); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/var/import.carbon b/toolchain/lower/testdata/var/import.carbon index ecc154057b7e9..19118095062da 100644 --- a/toolchain/lower/testdata/var/import.carbon +++ b/toolchain/lower/testdata/var/import.carbon @@ -54,12 +54,15 @@ fn Z() -> i32 { return z; } // CHECK:STDOUT: @_Cv.Main = global i32 0 // CHECK:STDOUT: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @_C__global_init.Main, ptr null }] // CHECK:STDOUT: -// CHECK:STDOUT: define void @_C__global_init.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_C__global_init.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: store i32 42, ptr @_Cv.Main, align 4, !dbg !7 // CHECK:STDOUT: ret void, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -77,12 +80,15 @@ fn Z() -> i32 { return z; } // CHECK:STDOUT: // CHECK:STDOUT: @_Cv.Main = external global i32 // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7 = load i32, ptr @_Cv.Main, align 4, !dbg !7 // CHECK:STDOUT: ret i32 %.loc7, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: @@ -105,7 +111,8 @@ fn Z() -> i32 { return z; } // CHECK:STDOUT: @tuple.092.loc8_1 = internal constant { i32, i32 } { i32 5, i32 6 } // CHECK:STDOUT: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @_C__global_init.Main, ptr null }] // CHECK:STDOUT: -// CHECK:STDOUT: define void @_C__global_init.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_C__global_init.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 @_Cv.Main, ptr align 4 @tuple.21c.loc4_1, i64 8, i1 false), !dbg !7 // CHECK:STDOUT: store i32 4, ptr @_Cy.Main, align 4, !dbg !8 @@ -114,12 +121,13 @@ fn Z() -> i32 { return z; } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} @@ -142,25 +150,29 @@ fn Z() -> i32 { return z; } // CHECK:STDOUT: @_Cy.Main = external global i32 // CHECK:STDOUT: @_Cz.Main = external global { i32, i32 } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CV.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CV.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc6 = load i32, ptr @_Cv.Main, align 4, !dbg !7 // CHECK:STDOUT: ret i32 %.loc6, !dbg !8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CW.Main() !dbg !9 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CW.Main() #0 !dbg !9 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7 = load i32, ptr getelementptr inbounds nuw ({ i32, i32 }, ptr @_Cv.Main, i32 0, i32 1), align 4, !dbg !10 // CHECK:STDOUT: ret i32 %.loc7, !dbg !11 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CY.Main() !dbg !12 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CY.Main() #0 !dbg !12 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc9 = load i32, ptr @_Cy.Main, align 4, !dbg !13 // CHECK:STDOUT: ret i32 %.loc9, !dbg !14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @_CZ.Main() !dbg !15 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CZ.Main() #0 !dbg !15 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc10 = load i32, ptr getelementptr inbounds nuw ({ i32, i32 }, ptr @_Cz.Main, i32 0, i32 1), align 4, !dbg !16 // CHECK:STDOUT: ret i32 %.loc10, !dbg !17 @@ -169,6 +181,8 @@ fn Z() -> i32 { return z; } // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @_Cv.Main, { 1, 0 } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/var/local.carbon b/toolchain/lower/testdata/var/local.carbon index a0dce6173b6c8..5d83be3b1f358 100644 --- a/toolchain/lower/testdata/var/local.carbon +++ b/toolchain/lower/testdata/var/local.carbon @@ -18,7 +18,8 @@ fn Run() -> i32 { // CHECK:STDOUT: ; ModuleID = 'local.carbon' // CHECK:STDOUT: source_filename = "local.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca i32, align 4, !dbg !7 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %x.var), !dbg !7 @@ -28,9 +29,10 @@ fn Run() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/var/nested.carbon b/toolchain/lower/testdata/var/nested.carbon index 837366990f868..e370321267ce8 100644 --- a/toolchain/lower/testdata/var/nested.carbon +++ b/toolchain/lower/testdata/var/nested.carbon @@ -22,7 +22,8 @@ fn Run() -> i32 { // CHECK:STDOUT: ; ModuleID = 'nested.carbon' // CHECK:STDOUT: source_filename = "nested.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: define i32 @main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca i32, align 4, !dbg !7 // CHECK:STDOUT: %b.var = alloca i32, align 4, !dbg !8 @@ -47,12 +48,13 @@ fn Run() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #0 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} diff --git a/toolchain/lower/testdata/while/break_continue.carbon b/toolchain/lower/testdata/while/break_continue.carbon index ab04cb5849be8..9de82fa31c871 100644 --- a/toolchain/lower/testdata/while/break_continue.carbon +++ b/toolchain/lower/testdata/while/break_continue.carbon @@ -30,7 +30,8 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: declare i1 @_CC.Main() // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CWhile.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CWhile.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: br label %while.cond // CHECK:STDOUT: @@ -62,6 +63,8 @@ fn While() { // CHECK:STDOUT: uselistorder label %while.cond, { 1, 2, 0 } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/while/preheader.carbon b/toolchain/lower/testdata/while/preheader.carbon index b3da370b00a5f..4b4be0a01ad46 100644 --- a/toolchain/lower/testdata/while/preheader.carbon +++ b/toolchain/lower/testdata/while/preheader.carbon @@ -39,7 +39,8 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CG.Main() // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CWhile.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CWhile.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: br label %while.cond.loc22 // CHECK:STDOUT: @@ -73,6 +74,8 @@ fn While() { // CHECK:STDOUT: uselistorder label %while.cond.loc22, { 1, 0 } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/while/unreachable_end.carbon b/toolchain/lower/testdata/while/unreachable_end.carbon index a77b5966019fb..b37a08c253f75 100644 --- a/toolchain/lower/testdata/while/unreachable_end.carbon +++ b/toolchain/lower/testdata/while/unreachable_end.carbon @@ -36,7 +36,8 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CH.Main() // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CWhile.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CWhile.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CF.Main(), !dbg !7 // CHECK:STDOUT: br label %while.cond, !dbg !8 @@ -54,6 +55,8 @@ fn While() { // CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/while/while.carbon b/toolchain/lower/testdata/while/while.carbon index 6b3e011991785..95d001679910f 100644 --- a/toolchain/lower/testdata/while/while.carbon +++ b/toolchain/lower/testdata/while/while.carbon @@ -35,7 +35,8 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CH.Main() // CHECK:STDOUT: -// CHECK:STDOUT: define void @_CWhile.Main() !dbg !4 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CWhile.Main() #0 !dbg !4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_CF.Main(), !dbg !7 // CHECK:STDOUT: br label %while.cond, !dbg !8 @@ -53,6 +54,8 @@ fn While() { // CHECK:STDOUT: ret void, !dbg !13 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1} // CHECK:STDOUT: !llvm.dbg.cu = !{!2} // CHECK:STDOUT: diff --git a/toolchain/testing/file_test.cpp b/toolchain/testing/file_test.cpp index 6f646ba6cff92..6d536e30832b2 100644 --- a/toolchain/testing/file_test.cpp +++ b/toolchain/testing/file_test.cpp @@ -92,6 +92,11 @@ class ToolchainFileTest : public FileTestBase { // Sets different default flags based on the component being tested. auto GetDefaultArgs() const -> llvm::SmallVector override; + // Returns string replacements to implement `%{key}` -> `value` in arguments. + auto GetArgReplacements() const -> llvm::StringMap override { + return {{"core", data_->installation.core_package().native()}}; + } + // Generally uses the parent implementation, with special handling for lex. auto GetDefaultFileRE(llvm::ArrayRef filenames) const -> std::optional override; @@ -296,6 +301,15 @@ static auto DoClangASTCheckReplacements(std::string& check_line) -> void { auto ToolchainFileTest::DoExtraCheckReplacements(std::string& check_line) const -> void { + // The path to the core package appears in various places, such as some check + // diagnostics and debug information produced by lowering, and will differ + // between testing environments, so don't test it. + // TODO: Consider adding a content keyword to name the core package, and + // replace with that instead. Alternatively, consider adding the core + // package to the VFS with a fixed name. + absl::StrReplaceAll({{data_->installation.core_package().native(), "{{.*}}"}}, + &check_line); + if (component_ == "driver") { // TODO: Disable token output, it's not interesting for these tests. if (llvm::StringRef(check_line).starts_with("// CHECK:STDOUT: {")) { @@ -308,29 +322,19 @@ auto ToolchainFileTest::DoExtraCheckReplacements(std::string& check_line) const // The column happens to be right for FileStart, but the line is wrong. static RE2 file_token_re(R"((FileEnd.*column: |FileStart.*line: )( *\d+))"); RE2::Replace(&check_line, file_token_re, R"(\1{{ *\\d+}})"); - } else if (component_ == "check" || component_ == "lower") { - // The path to the core package appears in some check diagnostics and in - // debug information produced by lowering, and will differ between testing - // environments, so don't test it. - // TODO: Consider adding a content keyword to name the core package, and - // replace with that instead. Alternatively, consider adding the core - // package to the VFS with a fixed name. - absl::StrReplaceAll( - {{data_->installation.core_package().native(), "{{.*}}"}}, &check_line); - if (component_ == "check") { - DoClangASTCheckReplacements(check_line); - - // Reduce instruction numbering sensitivity; this is brittle for - // instruction edits including adding/removing singleton instructions. - static RE2 inst_re( - R"(((?:import_ref [^,]*, |\.)inst)[0-9A-F]+)"); - RE2::Replace(&check_line, inst_re, R"(\1{{[0-9A-F]+}})"); - - // Reduce location sensitivity in imports referring to `Core`; this is - // brittle for small edits, including comment changes. - static RE2 core_loc_re(R"((import_ref Core//[^,]*, loc)\d+_\d+)"); - RE2::Replace(&check_line, core_loc_re, R"(\1{{\\d+_\\d+}})"); - } + } else if (component_ == "check") { + DoClangASTCheckReplacements(check_line); + + // Reduce instruction numbering sensitivity; this is brittle for + // instruction edits including adding/removing singleton instructions. + static RE2 inst_re( + R"(((?:import_ref [^,]*, |\.)inst)[0-9A-F]+)"); + RE2::Replace(&check_line, inst_re, R"(\1{{[0-9A-F]+}})"); + + // Reduce location sensitivity in imports referring to `Core`; this is + // brittle for small edits, including comment changes. + static RE2 core_loc_re(R"((import_ref Core//[^,]*, loc)\d+_\d+)"); + RE2::Replace(&check_line, core_loc_re, R"(\1{{\\d+_\\d+}})"); } else { FileTestBase::DoExtraCheckReplacements(check_line); }