{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/11366","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/11366/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/11366/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/11366/events","html_url":"https://github.com/JuliaLang/julia/issues/11366","id":78335940,"number":11366,"title":"Codegen bug due to non-equal LLVM types for a given julia type","user":{"login":"Keno","id":1291671,"avatar_url":"https://avatars.githubusercontent.com/u/1291671?v=3","gravatar_id":"","url":"https://api.github.com/users/Keno","html_url":"https://github.com/Keno","followers_url":"https://api.github.com/users/Keno/followers","following_url":"https://api.github.com/users/Keno/following{/other_user}","gists_url":"https://api.github.com/users/Keno/gists{/gist_id}","starred_url":"https://api.github.com/users/Keno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Keno/subscriptions","organizations_url":"https://api.github.com/users/Keno/orgs","repos_url":"https://api.github.com/users/Keno/repos","events_url":"https://api.github.com/users/Keno/events{/privacy}","received_events_url":"https://api.github.com/users/Keno/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/codegen","name":"codegen","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-20T02:22:07Z","updated_at":"2015-05-20T21:57:55Z","closed_at":null,"body":"I'm not quite sure where the actual bug is, but here's the situation. I have a function, where for the first argument,\r\n\r\n```\r\n(lldb) p jl_(vi.declType)\r\nMain.LLVMGraph{Cxx.CppPtr{Cxx.CppValue{Cxx.CppBaseType{:llvm::Function}, (false, false, false)}, (false, false, false)}, Cxx.CppPtr{Cxx.CppValue{#T<:Any, #CVR<:Any}, CVR<:Any}}\r\n\r\n(lldb) p jl_(jl_svecref(((jl_datatype_t*)(lam->specTypes))->parameters, 0))\r\nMain.LLVMGraph{Cxx.CppPtr{Cxx.CppValue{Cxx.CppBaseType{:llvm::Function}, (false, false, false)}, (false, false, false)}, Cxx.CppPtr{Cxx.CppValue{#T<:Any, #CVR<:Any}, CVR<:Any}}\r\n\r\n(lldb) p jl_egal(vi.declType,jl_svecref(((jl_datatype_t*)(lam->specTypes))->parameters, 0))\r\n(int) $254 = 1\r\n```\r\n\r\nbut\r\n\r\n```\r\n(lldb) p julia_type_to_llvm(vi.declType)->dump()\r\n%LLVMGraph.110 = type { %CppPtr.11 }\r\n\r\n(lldb) p julia_type_to_llvm(jl_svecref(((jl_datatype_t*)(lam->specTypes))->parameters, 0))\r\n%LLVMGraph = type { %CppPtr.11 }\r\n```\r\n\r\ni.e. the LLVM types are not equal. This confuses codegen horribly, because it assumes it's on one of those cases where type inference gave it bad type information and tries to bail out early. There could be several possibly approaches here:\r\n1. The types should have been uniqued in the first place\r\n2. The types need not be unique but they should give the same LLVM type\r\n3. They shouldn't, but we need to convert between them\r\n\r\nAny of these options is fine, though the last one will probably add quite a bit of complexity to our LLVM code as we currently assume that the same julia type will give us the same LLVM type in a number of places. cc @JeffBezanson because I can't evaluate the first two.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/104050683","html_url":"https://github.com/JuliaLang/julia/issues/11366#issuecomment-104050683","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/11366","id":104050683,"user":{"login":"Keno","id":1291671,"avatar_url":"https://avatars.githubusercontent.com/u/1291671?v=3","gravatar_id":"","url":"https://api.github.com/users/Keno","html_url":"https://github.com/Keno","followers_url":"https://api.github.com/users/Keno/followers","following_url":"https://api.github.com/users/Keno/following{/other_user}","gists_url":"https://api.github.com/users/Keno/gists{/gist_id}","starred_url":"https://api.github.com/users/Keno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Keno/subscriptions","organizations_url":"https://api.github.com/users/Keno/orgs","repos_url":"https://api.github.com/users/Keno/repos","events_url":"https://api.github.com/users/Keno/events{/privacy}","received_events_url":"https://api.github.com/users/Keno/received_events","type":"User","site_admin":false},"created_at":"2015-05-20T21:57:55Z","updated_at":"2015-05-20T21:57:55Z","body":"No, they are not address equal, which is what's causing the problem. I wasn't sure whether they should have been though, hence the issue."}}