{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/11899","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/11899/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/11899/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/11899/events","html_url":"https://github.com/JuliaLang/julia/issues/11899","id":91518358,"number":11899,"title":"SLP vectorization not working for tuples","user":{"login":"jrevels","id":3277443,"avatar_url":"https://avatars.githubusercontent.com/u/3277443?v=3","gravatar_id":"","url":"https://api.github.com/users/jrevels","html_url":"https://github.com/jrevels","followers_url":"https://api.github.com/users/jrevels/followers","following_url":"https://api.github.com/users/jrevels/following{/other_user}","gists_url":"https://api.github.com/users/jrevels/gists{/gist_id}","starred_url":"https://api.github.com/users/jrevels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrevels/subscriptions","organizations_url":"https://api.github.com/users/jrevels/orgs","repos_url":"https://api.github.com/users/jrevels/repos","events_url":"https://api.github.com/users/jrevels/events{/privacy}","received_events_url":"https://api.github.com/users/jrevels/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/performance","name":"performance","color":"d7e102"},{"url":"https://api.github.com/repos/JuliaLang/julia/labels/regression","name":"regression","color":"ff2510"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":22,"created_at":"2015-06-27T21:48:31Z","updated_at":"2015-10-30T18:05:04Z","closed_at":null,"body":"After reading #6271, I wanted to reproduce the vectorization that @ArchRobison displayed in his tuple example. Unfortunately, this doesn't seem to work any longer (just a copy-paste of the example given in the aforementioned PR):\r\n\r\n```julia\r\n$ julia -O\r\n               _\r\n   _       _ _(_)_     |  A fresh approach to technical computing\r\n  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org\r\n   _ _   _| |_  __ _   |  Type \"help()\" for help.\r\n  | | | | | | |/ _` |  |\r\n  | | |_| | | | (_| |  |  Version 0.4.0-dev+5513 (2015-06-22 15:58 UTC)\r\n _/ |\\__'_|_|_|\\__'_|  |  Commit faae194* (5 days old master)\r\n|__/                   |  x86_64-apple-darwin13.4.0\r\n\r\njulia> function add( a::NTuple{4,Float32}, b::NTuple{4,Float32} )\r\n           (a[1]+b[1],a[2]+b[2],a[3]+b[3],a[4]+b[4])\r\n       end\r\nadd (generic function with 1 method)\r\n\r\njulia> function mul( a::NTuple{4,Float32}, b::NTuple{4,Float32} )\r\n           (a[1]*b[1],a[2]*b[2],a[3]*b[3],a[4]*b[4])\r\n       end\r\nmul (generic function with 1 method)\r\n\r\njulia> function madd( a::NTuple{4,Float32}, b::NTuple{4,Float32}, c::NTuple{4,Float32} )\r\n           add(mul(a,b),c)\r\n       end\r\nmadd (generic function with 1 method)\r\n\r\njulia> t = NTuple{4,Float32}\r\nTuple{Float32,Float32,Float32,Float32}\r\n\r\njulia> code_llvm(madd,(t,t,t))\r\n\r\ndefine [4 x float] @julia_madd_21498([4 x float]*, [4 x float]*, [4 x float]*) {\r\ntop:\r\n  %3 = getelementptr inbounds [4 x float]* %0, i64 0, i64 0\r\n  %4 = load float* %3, align 4\r\n  %5 = getelementptr inbounds [4 x float]* %1, i64 0, i64 0\r\n  %6 = load float* %5, align 4\r\n  %7 = fmul float %4, %6\r\n  %8 = getelementptr inbounds [4 x float]* %0, i64 0, i64 1\r\n  %9 = load float* %8, align 4\r\n  %10 = getelementptr inbounds [4 x float]* %1, i64 0, i64 1\r\n  %11 = load float* %10, align 4\r\n  %12 = fmul float %9, %11\r\n  %13 = getelementptr inbounds [4 x float]* %0, i64 0, i64 2\r\n  %14 = load float* %13, align 4\r\n  %15 = getelementptr inbounds [4 x float]* %1, i64 0, i64 2\r\n  %16 = load float* %15, align 4\r\n  %17 = fmul float %14, %16\r\n  %18 = getelementptr inbounds [4 x float]* %0, i64 0, i64 3\r\n  %19 = load float* %18, align 4\r\n  %20 = getelementptr inbounds [4 x float]* %1, i64 0, i64 3\r\n  %21 = load float* %20, align 4\r\n  %22 = fmul float %19, %21\r\n  %23 = getelementptr inbounds [4 x float]* %2, i64 0, i64 0\r\n  %24 = load float* %23, align 4\r\n  %25 = fadd float %7, %24\r\n  %26 = insertvalue [4 x float] undef, float %25, 0\r\n  %27 = getelementptr inbounds [4 x float]* %2, i64 0, i64 1\r\n  %28 = load float* %27, align 4\r\n  %29 = fadd float %12, %28\r\n  %30 = insertvalue [4 x float] %26, float %29, 1\r\n  %31 = getelementptr inbounds [4 x float]* %2, i64 0, i64 2\r\n  %32 = load float* %31, align 4\r\n  %33 = fadd float %17, %32\r\n  %34 = insertvalue [4 x float] %30, float %33, 2\r\n  %35 = getelementptr inbounds [4 x float]* %2, i64 0, i64 3\r\n  %36 = load float* %35, align 4\r\n  %37 = fadd float %22, %36\r\n  %38 = insertvalue [4 x float] %34, float %37, 3\r\n  ret [4 x float] %38\r\n}\r\n```\r\n\r\nCaveat: I built v0.4 using LLVM 3.6, which wasn't tested in #6271."},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/152604312","html_url":"https://github.com/JuliaLang/julia/issues/11899#issuecomment-152604312","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/11899","id":152604312,"user":{"login":"ArchRobison","id":2983330,"avatar_url":"https://avatars.githubusercontent.com/u/2983330?v=3","gravatar_id":"","url":"https://api.github.com/users/ArchRobison","html_url":"https://github.com/ArchRobison","followers_url":"https://api.github.com/users/ArchRobison/followers","following_url":"https://api.github.com/users/ArchRobison/following{/other_user}","gists_url":"https://api.github.com/users/ArchRobison/gists{/gist_id}","starred_url":"https://api.github.com/users/ArchRobison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArchRobison/subscriptions","organizations_url":"https://api.github.com/users/ArchRobison/orgs","repos_url":"https://api.github.com/users/ArchRobison/repos","events_url":"https://api.github.com/users/ArchRobison/events{/privacy}","received_events_url":"https://api.github.com/users/ArchRobison/received_events","type":"User","site_admin":false},"created_at":"2015-10-30T18:05:04Z","updated_at":"2015-10-30T18:05:04Z","body":"Update: I submitted an LLVM [patch](http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151026/309190.html) yesterday that makes SLPVectorization work with tuples again.  Once it passes code review, it shouldn't be difficult to backport as a patch against LLVM 3.7.  The patch not only enables SLP vectorization of tuples; it also enables SLP vectorization of immutable types.\r\n\r\n[This gist](https://gist.github.com/ArchRobison/0151b1b7374f5fe7ea3b) shows two examples, one with tuple and one with immutable, that both vectorize with the patch."}}