Skip to content

Commit

Permalink
Add function debug info descriptions (carbon-language#4233)
Browse files Browse the repository at this point in the history
Still doesn't have line tables, so of limited value (at least now
this'll be enough that LLVM really generates debug info into the
resulting object file (whereas with only the compilation unit metadata,
LLVM will consider it empty and avoid emitting any of it)) - but another
step along the path.

This also doesn't attach the right source location to the functions -
I'll do that in a follow-up change because I think it'll require the
majority of the refactoring between driver and check to extract the
essential functionality sem_ir_diagnostic_converter, I think, to allow
retrieving source locations during lowering.

---------

Co-authored-by: Jon Ross-Perkins <[email protected]>
  • Loading branch information
dwblaikie and jonmeow authored Aug 22, 2024
1 parent 435ee44 commit ea8ad22
Show file tree
Hide file tree
Showing 102 changed files with 641 additions and 206 deletions.
20 changes: 20 additions & 0 deletions toolchain/lower/file_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ auto FileContext::BuildFunctionDefinition(SemIR::FunctionId function_id)
return;
}

llvm_function->setSubprogram(BuildDISubprogram(function, llvm_function));

FunctionContext function_lowering(*this, llvm_function, vlog_stream_);

// TODO: Pass in a specific ID for generic functions.
Expand Down Expand Up @@ -360,6 +362,24 @@ auto FileContext::BuildFunctionDefinition(SemIR::FunctionId function_id)
}
}

auto FileContext::BuildDISubprogram(const SemIR::Function& /*function*/,
const llvm::Function* llvm_function)
-> llvm::DISubprogram* {
if (!di_compile_unit_) {
return nullptr;
}
// FIXME: Add more details here, including mangled name, real subroutine type
// (once type information is built), etc.
return di_builder_.createFunction(
di_compile_unit_, llvm_function->getName(), /*LinkageName=*/"",
/*File=*/nullptr,
/*LineNo=*/0,
di_builder_.createSubroutineType(
di_builder_.getOrCreateTypeArray(std::nullopt)),
/*ScopeLine=*/0, llvm::DINode::FlagZero,
llvm::DISubprogram::SPFlagDefinition);
}

static auto BuildTypeForInst(FileContext& context, SemIR::ArrayType inst)
-> llvm::Type* {
return llvm::ArrayType::get(
Expand Down
5 changes: 5 additions & 0 deletions toolchain/lower/file_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ class FileContext {
// declaration with no definition, does nothing.
auto BuildFunctionDefinition(SemIR::FunctionId function_id) -> void;

// Build the DISubprogram metadata for the given function.
auto BuildDISubprogram(const SemIR::Function& function,
const llvm::Function* llvm_function)
-> llvm::DISubprogram*;

// Builds the type for the given instruction, which should then be cached by
// the caller.
auto BuildType(SemIR::InstId inst_id) -> llvm::Type*;
Expand Down
5 changes: 4 additions & 1 deletion toolchain/lower/testdata/alias/local.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn F() -> i32 {
// CHECK:STDOUT: ; ModuleID = 'local.carbon'
// CHECK:STDOUT: source_filename = "local.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define i32 @F() {
// CHECK:STDOUT: define i32 @F() !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %a.var = alloca i32, align 4
// CHECK:STDOUT: store i32 0, ptr %a.var, align 4
Expand All @@ -32,3 +32,6 @@ fn F() -> i32 {
// 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: "local.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
5 changes: 4 additions & 1 deletion toolchain/lower/testdata/array/array_in_place.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn G() {
// CHECK:STDOUT:
// CHECK:STDOUT: declare void @F(ptr sret({ i32, i32, i32 }))
// CHECK:STDOUT:
// CHECK:STDOUT: define void @G() {
// CHECK:STDOUT: define void @G() !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %v.var = alloca [2 x { i32, i32, i32 }], align 8
// CHECK:STDOUT: %.loc14_42.2.array.index = getelementptr inbounds [2 x { i32, i32, i32 }], ptr %v.var, i32 0, i32 0
Expand All @@ -36,3 +36,6 @@ fn G() {
// 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: "array_in_place.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "G", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
8 changes: 6 additions & 2 deletions toolchain/lower/testdata/array/assign_return_value.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ fn Run() {
// CHECK:STDOUT:
// CHECK:STDOUT: @tuple.loc11_39 = internal constant { i32, i32 } { i32 12, i32 24 }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @F(ptr sret({ i32, i32 }) %return) {
// CHECK:STDOUT: define void @F(ptr sret({ i32, i32 }) %return) !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %.loc11_38.2.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0
// CHECK:STDOUT: %.loc11_38.4.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.loc11_39, i64 8, i1 false)
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @main() {
// CHECK:STDOUT: define void @main() !dbg !7 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %t.var = alloca [2 x i32], align 4
// CHECK:STDOUT: %.loc14_22.1.temp = alloca { i32, i32 }, align 8
Expand Down Expand Up @@ -55,3 +55,7 @@ fn Run() {
// 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: "assign_return_value.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "main", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
5 changes: 4 additions & 1 deletion toolchain/lower/testdata/array/base.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn Run() {
// CHECK:STDOUT: @array.3.loc14_41 = internal constant [5 x {}] zeroinitializer
// CHECK:STDOUT: @tuple.2.loc15_37 = internal constant { i32, i32, i32 } { i32 1, i32 2, i32 3 }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @main() {
// CHECK:STDOUT: define void @main() !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %a.var = alloca [1 x i32], align 4
// CHECK:STDOUT: %.loc12_24.3.array.index = getelementptr inbounds [1 x i32], ptr %a.var, i32 0, i32 0
Expand Down Expand Up @@ -76,3 +76,6 @@ fn Run() {
// 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: "base.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "main", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
8 changes: 6 additions & 2 deletions toolchain/lower/testdata/array/function_param.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ fn G() -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: @array.loc16_11.1 = internal constant [3 x i32] [i32 1, i32 2, i32 3]
// CHECK:STDOUT:
// CHECK:STDOUT: define i32 @F(ptr %arr, i32 %i) {
// CHECK:STDOUT: define i32 @F(ptr %arr, i32 %i) !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %.loc12_15.2.array.index = getelementptr inbounds [3 x i32], ptr %arr, i32 0, i32 %i
// CHECK:STDOUT: %.loc12_15.3 = load i32, ptr %.loc12_15.2.array.index, align 4
// CHECK:STDOUT: ret i32 %.loc12_15.3
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define i32 @G() {
// CHECK:STDOUT: define i32 @G() !dbg !7 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %.loc16_20.2.temp = alloca [3 x i32], align 4
// CHECK:STDOUT: %.loc16_20.4.array.index = getelementptr inbounds [3 x i32], ptr %.loc16_20.2.temp, i32 0, i32 0
Expand All @@ -51,3 +51,7 @@ fn G() -> i32 {
// 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: "function_param.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "G", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
8 changes: 6 additions & 2 deletions toolchain/lower/testdata/basics/false_true.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ fn T() -> bool {
// CHECK:STDOUT: ; ModuleID = 'false_true.carbon'
// CHECK:STDOUT: source_filename = "false_true.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define i1 @F() {
// CHECK:STDOUT: define i1 @F() !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret i1 false
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define i1 @T() {
// CHECK:STDOUT: define i1 @T() !dbg !7 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret i1 true
// CHECK:STDOUT: }
Expand All @@ -36,3 +36,7 @@ fn T() -> bool {
// 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: "false_true.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "T", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
14 changes: 10 additions & 4 deletions toolchain/lower/testdata/basics/int_types.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ fn F_u65536(a: u65536) -> u65536 { return a; }
// CHECK:STDOUT: ; ModuleID = 'int_types.carbon'
// CHECK:STDOUT: source_filename = "int_types.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define i8 @F_i8(i8 %a) {
// CHECK:STDOUT: define i8 @F_i8(i8 %a) !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret i8 %a
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define i16 @F_u16(i16 %a) {
// CHECK:STDOUT: define i16 @F_u16(i16 %a) !dbg !7 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret i16 %a
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define i64 @F_i64(i64 %a) {
// CHECK:STDOUT: define i64 @F_i64(i64 %a) !dbg !8 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret i64 %a
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define i65536 @F_u65536(i65536 %a) {
// CHECK:STDOUT: define i65536 @F_u65536(i65536 %a) !dbg !9 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret i65536 %a
// CHECK:STDOUT: }
Expand All @@ -43,3 +43,9 @@ fn F_u65536(a: u65536) -> u65536 { return a; }
// 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: "int_types.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F_i8", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "F_u16", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "F_i64", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "F_u65536", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
5 changes: 4 additions & 1 deletion toolchain/lower/testdata/basics/numeric_literals.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn F() {
// CHECK:STDOUT: @array.1.loc19_4 = internal constant [4 x i32] [i32 8, i32 9, i32 8, i32 8]
// CHECK:STDOUT: @array.2.loc27_4 = 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 @F() {
// CHECK:STDOUT: define void @F() !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %ints.var = alloca [4 x i32], align 4
// CHECK:STDOUT: %.loc19_3.3.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 0
Expand Down Expand Up @@ -67,3 +67,6 @@ fn F() {
// 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: "numeric_literals.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
11 changes: 8 additions & 3 deletions toolchain/lower/testdata/basics/type_values.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ fn F64() -> type {
// CHECK:STDOUT:
// CHECK:STDOUT: %type = type {}
// CHECK:STDOUT:
// CHECK:STDOUT: define %type @I32() {
// CHECK:STDOUT: define %type @I32() !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret %type zeroinitializer
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define %type @I48() {
// CHECK:STDOUT: define %type @I48() !dbg !7 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret %type zeroinitializer
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define %type @F64() {
// CHECK:STDOUT: define %type @F64() !dbg !8 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret %type zeroinitializer
// CHECK:STDOUT: }
Expand All @@ -50,3 +50,8 @@ fn F64() -> type {
// 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: "type_values.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "I32", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "I48", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "F64", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
5 changes: 4 additions & 1 deletion toolchain/lower/testdata/basics/zero.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn Main() -> i32 {
// CHECK:STDOUT: ; ModuleID = 'zero.carbon'
// CHECK:STDOUT: source_filename = "zero.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define i32 @Main() {
// CHECK:STDOUT: define i32 @Main() !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret i32 0
// CHECK:STDOUT: }
Expand All @@ -27,3 +27,6 @@ fn Main() -> i32 {
// 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: "zero.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Main", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
35 changes: 24 additions & 11 deletions toolchain/lower/testdata/builtins/float.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -44,67 +44,67 @@ fn TestGreaterEq(a: f64, b: f64) -> bool { return GreaterEq(a, b); }
// CHECK:STDOUT: ; ModuleID = 'float.carbon'
// CHECK:STDOUT: source_filename = "float.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define double @TestNegate(double %a) {
// CHECK:STDOUT: define double @TestNegate(double %a) !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %float.negate = fneg double %a
// CHECK:STDOUT: ret double %float.negate
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define double @TestAdd(double %a, double %b) {
// CHECK:STDOUT: define double @TestAdd(double %a, double %b) !dbg !7 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %float.add = fadd double %a, %b
// CHECK:STDOUT: ret double %float.add
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define double @TestSub(double %a, double %b) {
// CHECK:STDOUT: define double @TestSub(double %a, double %b) !dbg !8 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %float.sub = fsub double %a, %b
// CHECK:STDOUT: ret double %float.sub
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define double @TestMul(double %a, double %b) {
// CHECK:STDOUT: define double @TestMul(double %a, double %b) !dbg !9 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %float.mul = fmul double %a, %b
// CHECK:STDOUT: ret double %float.mul
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define double @TestDiv(double %a, double %b) {
// CHECK:STDOUT: define double @TestDiv(double %a, double %b) !dbg !10 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %float.div = fdiv double %a, %b
// CHECK:STDOUT: ret double %float.div
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define i1 @TestEq(double %a, double %b) {
// CHECK:STDOUT: define i1 @TestEq(double %a, double %b) !dbg !11 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %float.eq = fcmp oeq double %a, %b
// CHECK:STDOUT: ret i1 %float.eq
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define i1 @TestNeq(double %a, double %b) {
// CHECK:STDOUT: define i1 @TestNeq(double %a, double %b) !dbg !12 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %float.neq = fcmp one double %a, %b
// CHECK:STDOUT: ret i1 %float.neq
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define i1 @TestLess(double %a, double %b) {
// CHECK:STDOUT: define i1 @TestLess(double %a, double %b) !dbg !13 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %float.less = fcmp olt double %a, %b
// CHECK:STDOUT: ret i1 %float.less
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define i1 @TestLessEq(double %a, double %b) {
// CHECK:STDOUT: define i1 @TestLessEq(double %a, double %b) !dbg !14 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %float.less_eq = fcmp ole double %a, %b
// CHECK:STDOUT: ret i1 %float.less_eq
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define i1 @TestGreater(double %a, double %b) {
// CHECK:STDOUT: define i1 @TestGreater(double %a, double %b) !dbg !15 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %float.greater = fcmp ogt double %a, %b
// CHECK:STDOUT: ret i1 %float.greater
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define i1 @TestGreaterEq(double %a, double %b) {
// CHECK:STDOUT: define i1 @TestGreaterEq(double %a, double %b) !dbg !16 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %float.greater_eq = fcmp oge double %a, %b
// CHECK:STDOUT: ret i1 %float.greater_eq
Expand All @@ -117,3 +117,16 @@ fn TestGreaterEq(a: f64, b: f64) -> bool { return GreaterEq(a, b); }
// 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: "float.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "TestNegate", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !7 = distinct !DISubprogram(name: "TestAdd", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "TestSub", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "TestMul", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "TestDiv", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "TestEq", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "TestNeq", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !13 = distinct !DISubprogram(name: "TestLess", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "TestLessEq", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "TestGreater", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !16 = distinct !DISubprogram(name: "TestGreaterEq", scope: null, type: !5, spFlags: DISPFlagDefinition, unit: !2)
Loading

0 comments on commit ea8ad22

Please sign in to comment.