Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small typo in code example in the llvm.md documentation #49943

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

mdmaas
Copy link
Contributor

@mdmaas mdmaas commented May 23, 2023

The code in the documentation returns an error:

ERROR: MethodError: no method matching _dump_function(::typeof(+), ::Type{Tuple{Int64, Int64}}, ::Bool, ::Bool, ::Bool, ::Bool, ::Symbol, ::Bool, ::Symbol)

apparently, one boolean variable was missing from the call to InteractiveUtils._dump_function. Adding one false at the end of the call should fix that.

The code in the documentation returns an error:
```
ERROR: MethodError: no method matching _dump_function(::typeof(+), ::Type{Tuple{Int64, Int64}}, ::Bool, ::Bool, ::Bool, ::Bool, ::Symbol, ::Bool, ::Symbol)
```
apparently, one boolean variable was missing from the call to `InteractiveUtils._dump_function`. Adding one `false` at the end of the call should fix that.
@mdmaas mdmaas changed the title typo in llvm.md doc small typo in code example in the llvm.md documentation May 23, 2023
@ViralBShah ViralBShah added the domain:docs This change adds or pertains to documentation label May 24, 2023
@Keno
Copy link
Member

Keno commented May 24, 2023

Can we doctest this to make sure it doesn't regress again?

@inkydragon
Copy link
Sponsor Member

Can we doctest this to make sure it doesn't regress again?

The output contains system information (target triple = "x86_64-w64-windows-gnu-elf"), so it may not be easy to do doctest.

There is an underscore in the name of the function (InteractiveUtils._dump_function ), perhaps this is an internal api?.

julia> fun, T = +, Tuple{Int,Int} # Substitute your function of interest here
(+, Tuple{Int64, Int64})

julia> optimize = false
false

julia> print(InteractiveUtils._dump_function(fun, T, false, false, false, true, :att, optimize, :default, false))
; ModuleID = '+'
source_filename = "+"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:10:11:12:13"
target triple = "x86_64-w64-windows-gnu-elf"

;  @ int.jl:87 within `+`
; Function Attrs: uwtable
define i64 @"julia_+_79"(i64 signext %0, i64 signext %1) #0 !dbg !5 {
top:
  %2 = call {}*** @julia.get_pgcstack()
  %3 = bitcast {}*** %2 to {}**
  %current_task = getelementptr inbounds {}*, {}** %3, i64 -12
  %4 = bitcast {}** %current_task to i64*
  %world_age = getelementptr inbounds i64, i64* %4, i64 13
  %5 = add i64 %0, %1, !dbg !7
  ret i64 %5, !dbg !7
}

; Function Attrs: uwtable
define nonnull {} addrspace(10)* @"jfptr_+_80"({} addrspace(10)* %0, {} addrspace(10)** %1, i32 %2) #1 {
top:
  %3 = call {}*** @julia.get_pgcstack()
  %4 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %1, i32 0
  %5 = load {} addrspace(10)*, {} addrspace(10)** %4, align 8, !nonnull !4, !dereferenceable !8, !align !8
  %6 = bitcast {} addrspace(10)* %5 to i64 addrspace(10)*
  %7 = addrspacecast i64 addrspace(10)* %6 to i64 addrspace(11)*
  %8 = load i64, i64 addrspace(11)* %7, align 8
  %9 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)** %1, i32 1
  %10 = load {} addrspace(10)*, {} addrspace(10)** %9, align 8, !nonnull !4, !dereferenceable !8, !align !8
  %11 = bitcast {} addrspace(10)* %10 to i64 addrspace(10)*
  %12 = addrspacecast i64 addrspace(10)* %11 to i64 addrspace(11)*
  %13 = load i64, i64 addrspace(11)* %12, align 8
  %14 = call i64 @"julia_+_79"(i64 signext %8, i64 signext %13) #0
  %15 = call nonnull {} addrspace(10)* @ijl_box_int64(i64 signext %14)
  ret {} addrspace(10)* %15
}

declare {}*** @julia.get_pgcstack()

declare nonnull {} addrspace(10)* @ijl_box_int64(i64 signext)

attributes #0 = { uwtable "frame-pointer"="all" }
attributes #1 = { uwtable "frame-pointer"="all" "thunk" }

!llvm.module.flags = !{!0, !1}
!llvm.dbg.cu = !{!2}

!0 = !{i32 2, !"Dwarf Version", i32 4}
!1 = !{i32 2, !"Debug Info Version", i32 3}
!2 = distinct !DICompileUnit(language: DW_LANG_Julia, file: !3, producer: "julia", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !4, nameTableKind: GNU)
!3 = !DIFile(filename: "int.jl", directory: ".")
!4 = !{}
!5 = distinct !DISubprogram(name: "+", linkageName: "julia_+_79", scope: null, file: !3, line: 87, type: !6, scopeLine: 87, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!6 = !DISubroutineType(types: !4)
!7 = !DILocation(line: 87, scope: !5)
!8 = !{i64 8}

@KristofferC KristofferC merged commit 022924c into JuliaLang:master Aug 14, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants