<p dir="auto">MWE:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@inline use(i::Int64) =
    Base.llvmcall(&quot;&quot;&quot;%slot = alloca i64
                     store volatile i64 %0, i64* %slot
                     %value = load volatile i64, i64* %slot
                     ret i64 %value&quot;&quot;&quot;, Int64, Tuple{Int64}, i)


struct Wrapper{F} &lt;: Core.Function
    f::F
end

function (k::Wrapper)(arg1, arg2)
    (k.f)(arg1, arg2)
    return nothing
end


foobar(unused, used) = use(used)

code_llvm(Wrapper(foobar), Tuple{Type{Int64}, Int64})"><pre class="notranslate"><span class="pl-c1">@inline</span> <span class="pl-en">use</span>(i<span class="pl-k">::</span><span class="pl-c1">Int64</span>) <span class="pl-k">=</span>
    Base<span class="pl-k">.</span><span class="pl-c1">llvmcall</span>(<span class="pl-s"><span class="pl-pds">"""</span>%slot = alloca i64</span>
<span class="pl-s">                     store volatile i64 %0, i64* %slot</span>
<span class="pl-s">                     %value = load volatile i64, i64* %slot</span>
<span class="pl-s">                     ret i64 %value<span class="pl-pds">"""</span></span>, Int64, Tuple{Int64}, i)


<span class="pl-k">struct</span> Wrapper{F} <span class="pl-k">&lt;:</span> <span class="pl-c1">Core.Function</span>
    f<span class="pl-k">::</span><span class="pl-c1">F</span>
<span class="pl-k">end</span>

<span class="pl-k">function</span> (k<span class="pl-k">::</span><span class="pl-c1">Wrapper</span>)(arg1, arg2)
    (k<span class="pl-k">.</span>f)(arg1, arg2)
    <span class="pl-k">return</span> <span class="pl-c1">nothing</span>
<span class="pl-k">end</span>


<span class="pl-en">foobar</span>(unused, used) <span class="pl-k">=</span> <span class="pl-c1">use</span>(used)

<span class="pl-c1">code_llvm</span>(<span class="pl-c1">Wrapper</span>(foobar), Tuple{Type{Int64}, Int64})</pre></div>
<p dir="auto">Before <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="336858559" data-permission-text="Title is private" data-url="https://github.com/JuliaLang/julia/issues/27857" data-hovercard-type="pull_request" data-hovercard-url="/JuliaLang/julia/pull/27857/hovercard" href="https://github.com/JuliaLang/julia/pull/27857">#27857</a>:</p>
<div class="highlight highlight-source-llvm notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="; Function Wrapper
; Location: /home/tbesard/Julia/CUDAnative/wip.jl:13
define void @julia_Wrapper_32376(%jl_value_t addrspace(10)*, i64) {
top:
  %slot.i = alloca i64, align 8
; Function foobar; {
; Location: /home/tbesard/Julia/CUDAnative/wip.jl:18
; Function use; {
; Location: /home/tbesard/Julia/CUDAnative/wip.jl:1
  %slot.i.0.slot.i.0..sroa_cast = bitcast i64* %slot.i to i8*
  call void @llvm.lifetime.start.p0i8(i64 8, i8* %slot.i.0.slot.i.0..sroa_cast)
  store volatile i64 %1, i64* %slot.i, align 8
  %slot.i.0.slot.i.0.slot.0.slot.0.value.i = load volatile i64, i64* %slot.i, align 8
  call void @llvm.lifetime.end.p0i8(i64 8, i8* %slot.i.0.slot.i.0..sroa_cast)
;}}
; Location: /home/tbesard/Julia/CUDAnative/wip.jl:14
  ret void
}"><pre class="notranslate"><span class="pl-c">; Function Wrapper</span>
<span class="pl-c">; Location: /home/tbesard/Julia/CUDAnative/wip.jl:13</span>
<span class="pl-k">define</span> <span class="pl-k">void</span> <span class="pl-c1">@julia_Wrapper_32376</span>(<span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)*, <span class="pl-k">i64</span>) {
top:
  <span class="pl-c1">%slot.i</span> = <span class="pl-k">alloca</span> <span class="pl-k">i64</span>, <span class="pl-k">align</span> <span class="pl-c1">8</span>
<span class="pl-c">; Function foobar; {</span>
<span class="pl-c">; Location: /home/tbesard/Julia/CUDAnative/wip.jl:18</span>
<span class="pl-c">; Function use; {</span>
<span class="pl-c">; Location: /home/tbesard/Julia/CUDAnative/wip.jl:1</span>
  <span class="pl-c1">%slot.i.0.slot.i.0..sroa_cast</span> = <span class="pl-k">bitcast</span> <span class="pl-k">i64*</span> <span class="pl-c1">%slot.i</span> <span class="pl-k">to</span> <span class="pl-k">i8*</span>
  <span class="pl-k">call</span> <span class="pl-k">void</span> <span class="pl-c1">@llvm.lifetime.start.p0i8</span>(<span class="pl-k">i64</span> <span class="pl-c1">8</span>, <span class="pl-k">i8*</span> <span class="pl-c1">%slot.i.0.slot.i.0..sroa_cast</span>)
  <span class="pl-k">store</span> <span class="pl-k">volatile</span> <span class="pl-k">i64</span> <span class="pl-c1">%1</span>, <span class="pl-k">i64*</span> <span class="pl-c1">%slot.i</span>, <span class="pl-k">align</span> <span class="pl-c1">8</span>
  <span class="pl-c1">%slot.i.0.slot.i.0.slot.0.slot.0.value.i</span> = <span class="pl-k">load</span> <span class="pl-k">volatile</span> <span class="pl-k">i64</span>, <span class="pl-k">i64*</span> <span class="pl-c1">%slot.i</span>, <span class="pl-k">align</span> <span class="pl-c1">8</span>
  <span class="pl-k">call</span> <span class="pl-k">void</span> <span class="pl-c1">@llvm.lifetime.end.p0i8</span>(<span class="pl-k">i64</span> <span class="pl-c1">8</span>, <span class="pl-k">i8*</span> <span class="pl-c1">%slot.i.0.slot.i.0..sroa_cast</span>)
<span class="pl-c">;}}</span>
<span class="pl-c">; Location: /home/tbesard/Julia/CUDAnative/wip.jl:14</span>
  <span class="pl-k">ret</span> <span class="pl-k">void</span>
}</pre></div>
<p dir="auto">After:</p>
<div class="highlight highlight-source-llvm notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="; Function Wrapper
; Location: /home/tbesard/Julia/CUDAnative/wip.jl:13
define void @julia_Wrapper_32797(%jl_value_t addrspace(10)*, i64) {
top:
  %2 = alloca %jl_value_t addrspace(10)*, i32 3
  %gcframe = alloca %jl_value_t addrspace(10)*, i32 3
  %3 = bitcast %jl_value_t addrspace(10)** %gcframe to i8*
  call void @llvm.memset.p0i8.i32(i8* %3, i8 0, i32 24, i32 0, i1 false)
  %thread_ptr = call i8* asm &quot;movq %fs:0, $0&quot;, &quot;=r&quot;()
  %ptls_i8 = getelementptr i8, i8* %thread_ptr, i64 -10920
  %ptls = bitcast i8* %ptls_i8 to %jl_value_t***
  %4 = getelementptr %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)** %gcframe, i32 0
  %5 = bitcast %jl_value_t addrspace(10)** %4 to i64*
  store i64 2, i64* %5
  %6 = getelementptr %jl_value_t**, %jl_value_t*** %ptls, i32 0
  %7 = getelementptr %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)** %gcframe, i32 1
  %8 = bitcast %jl_value_t addrspace(10)** %7 to %jl_value_t***
  %9 = load %jl_value_t**, %jl_value_t*** %6
  store %jl_value_t** %9, %jl_value_t*** %8
  %10 = bitcast %jl_value_t*** %6 to %jl_value_t addrspace(10)***
  store %jl_value_t addrspace(10)** %gcframe, %jl_value_t addrspace(10)*** %10
  %11 = call %jl_value_t addrspace(10)* @jl_box_int64(i64 signext %1)
  %12 = getelementptr %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)** %gcframe, i32 2
  store %jl_value_t addrspace(10)* %11, %jl_value_t addrspace(10)** %12
  %13 = getelementptr %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)** %2, i32 0
  store %jl_value_t addrspace(10)* addrspacecast (%jl_value_t* inttoptr (i64 140506765508720 to %jl_value_t*) to %jl_value_t addrspace(10)*), %jl_value_t addrspace(10)** %13
  %14 = getelementptr %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)** %2, i32 1
  store %jl_value_t addrspace(10)* addrspacecast (%jl_value_t* inttoptr (i64 140506765445104 to %jl_value_t*) to %jl_value_t addrspace(10)*), %jl_value_t addrspace(10)** %14
  %15 = getelementptr %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)** %2, i32 2
  store %jl_value_t addrspace(10)* %11, %jl_value_t addrspace(10)** %15
  %16 = call nonnull %jl_value_t addrspace(10)* @jl_invoke(%jl_value_t addrspace(10)* addrspacecast (%jl_value_t* inttoptr (i64 140506779001488 to %jl_value_t*) to %jl_value_t addrspace(10)*), %jl_value_t addrspace(10)** %2, i32 3)
; Location: /home/tbesard/Julia/CUDAnative/wip.jl:14
  %17 = getelementptr %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)** %gcframe, i32 1
  %18 = load %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)** %17
  %19 = getelementptr %jl_value_t**, %jl_value_t*** %ptls, i32 0
  %20 = bitcast %jl_value_t*** %19 to %jl_value_t addrspace(10)**
  store %jl_value_t addrspace(10)* %18, %jl_value_t addrspace(10)** %20
  ret void
}"><pre class="notranslate"><span class="pl-c">; Function Wrapper</span>
<span class="pl-c">; Location: /home/tbesard/Julia/CUDAnative/wip.jl:13</span>
<span class="pl-k">define</span> <span class="pl-k">void</span> <span class="pl-c1">@julia_Wrapper_32797</span>(<span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)*, <span class="pl-k">i64</span>) {
top:
  <span class="pl-c1">%2</span> = <span class="pl-k">alloca</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)*, <span class="pl-k">i32</span> <span class="pl-c1">3</span>
  <span class="pl-c1">%gcframe</span> = <span class="pl-k">alloca</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)*, <span class="pl-k">i32</span> <span class="pl-c1">3</span>
  <span class="pl-c1">%3</span> = <span class="pl-k">bitcast</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%gcframe</span> <span class="pl-k">to</span> <span class="pl-k">i8*</span>
  <span class="pl-k">call</span> <span class="pl-k">void</span> <span class="pl-c1">@llvm.memset.p0i8.i32</span>(<span class="pl-k">i8*</span> <span class="pl-c1">%3</span>, <span class="pl-k">i8</span> <span class="pl-c1">0</span>, <span class="pl-k">i32</span> <span class="pl-c1">24</span>, <span class="pl-k">i32</span> <span class="pl-c1">0</span>, <span class="pl-k">i1</span> <span class="pl-k">false</span>)
  <span class="pl-c1">%thread_ptr</span> = <span class="pl-k">call</span> <span class="pl-k">i8*</span> <span class="pl-k">asm</span> <span class="pl-s">"movq %fs:0, $0"</span>, <span class="pl-s">"=r"</span>()
  <span class="pl-c1">%ptls_i8</span> = <span class="pl-k">getelementptr</span> <span class="pl-k">i8</span>, <span class="pl-k">i8*</span> <span class="pl-c1">%thread_ptr</span>, <span class="pl-k">i64</span> -<span class="pl-c1">10920</span>
  <span class="pl-c1">%ptls</span> = <span class="pl-k">bitcast</span> <span class="pl-k">i8*</span> <span class="pl-c1">%ptls_i8</span> <span class="pl-k">to</span> <span class="pl-k">%jl_value_t***</span>
  <span class="pl-c1">%4</span> = <span class="pl-k">getelementptr</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)*, <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%gcframe</span>, <span class="pl-k">i32</span> <span class="pl-c1">0</span>
  <span class="pl-c1">%5</span> = <span class="pl-k">bitcast</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%4</span> <span class="pl-k">to</span> <span class="pl-k">i64*</span>
  <span class="pl-k">store</span> <span class="pl-k">i64</span> <span class="pl-c1">2</span>, <span class="pl-k">i64*</span> <span class="pl-c1">%5</span>
  <span class="pl-c1">%6</span> = <span class="pl-k">getelementptr</span> <span class="pl-k">%jl_value_t**</span>, <span class="pl-k">%jl_value_t***</span> <span class="pl-c1">%ptls</span>, <span class="pl-k">i32</span> <span class="pl-c1">0</span>
  <span class="pl-c1">%7</span> = <span class="pl-k">getelementptr</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)*, <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%gcframe</span>, <span class="pl-k">i32</span> <span class="pl-c1">1</span>
  <span class="pl-c1">%8</span> = <span class="pl-k">bitcast</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%7</span> <span class="pl-k">to</span> <span class="pl-k">%jl_value_t***</span>
  <span class="pl-c1">%9</span> = <span class="pl-k">load</span> <span class="pl-k">%jl_value_t**</span>, <span class="pl-k">%jl_value_t***</span> <span class="pl-c1">%6</span>
  <span class="pl-k">store</span> <span class="pl-k">%jl_value_t**</span> <span class="pl-c1">%9</span>, <span class="pl-k">%jl_value_t***</span> <span class="pl-c1">%8</span>
  <span class="pl-c1">%10</span> = <span class="pl-k">bitcast</span> <span class="pl-k">%jl_value_t***</span> <span class="pl-c1">%6</span> <span class="pl-k">to</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)***
  <span class="pl-k">store</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%gcframe</span>, <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)*** <span class="pl-c1">%10</span>
  <span class="pl-c1">%11</span> = <span class="pl-k">call</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)* <span class="pl-c1">@jl_box_int64</span>(<span class="pl-k">i64</span> <span class="pl-k">signext</span> <span class="pl-c1">%1</span>)
  <span class="pl-c1">%12</span> = <span class="pl-k">getelementptr</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)*, <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%gcframe</span>, <span class="pl-k">i32</span> <span class="pl-c1">2</span>
  <span class="pl-k">store</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)* <span class="pl-c1">%11</span>, <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%12</span>
  <span class="pl-c1">%13</span> = <span class="pl-k">getelementptr</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)*, <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%2</span>, <span class="pl-k">i32</span> <span class="pl-c1">0</span>
  <span class="pl-k">store</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)* addrspacecast (<span class="pl-k">%jl_value_t*</span> <span class="pl-k">inttoptr</span> (<span class="pl-k">i64</span> <span class="pl-c1">140506765508720</span> <span class="pl-k">to</span> <span class="pl-k">%jl_value_t*</span>) <span class="pl-k">to</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)*), <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%13</span>
  <span class="pl-c1">%14</span> = <span class="pl-k">getelementptr</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)*, <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%2</span>, <span class="pl-k">i32</span> <span class="pl-c1">1</span>
  <span class="pl-k">store</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)* addrspacecast (<span class="pl-k">%jl_value_t*</span> <span class="pl-k">inttoptr</span> (<span class="pl-k">i64</span> <span class="pl-c1">140506765445104</span> <span class="pl-k">to</span> <span class="pl-k">%jl_value_t*</span>) <span class="pl-k">to</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)*), <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%14</span>
  <span class="pl-c1">%15</span> = <span class="pl-k">getelementptr</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)*, <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%2</span>, <span class="pl-k">i32</span> <span class="pl-c1">2</span>
  <span class="pl-k">store</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)* <span class="pl-c1">%11</span>, <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%15</span>
  <span class="pl-c1">%16</span> = <span class="pl-k">call</span> <span class="pl-k">nonnull</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)* <span class="pl-c1">@jl_invoke</span>(<span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)* addrspacecast (<span class="pl-k">%jl_value_t*</span> <span class="pl-k">inttoptr</span> (<span class="pl-k">i64</span> <span class="pl-c1">140506779001488</span> <span class="pl-k">to</span> <span class="pl-k">%jl_value_t*</span>) <span class="pl-k">to</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)*), <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%2</span>, <span class="pl-k">i32</span> <span class="pl-c1">3</span>)
<span class="pl-c">; Location: /home/tbesard/Julia/CUDAnative/wip.jl:14</span>
  <span class="pl-c1">%17</span> = <span class="pl-k">getelementptr</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)*, <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%gcframe</span>, <span class="pl-k">i32</span> <span class="pl-c1">1</span>
  <span class="pl-c1">%18</span> = <span class="pl-k">load</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)*, <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%17</span>
  <span class="pl-c1">%19</span> = <span class="pl-k">getelementptr</span> <span class="pl-k">%jl_value_t**</span>, <span class="pl-k">%jl_value_t***</span> <span class="pl-c1">%ptls</span>, <span class="pl-k">i32</span> <span class="pl-c1">0</span>
  <span class="pl-c1">%20</span> = <span class="pl-k">bitcast</span> <span class="pl-k">%jl_value_t***</span> <span class="pl-c1">%19</span> <span class="pl-k">to</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)**
  <span class="pl-k">store</span> <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)* <span class="pl-c1">%18</span>, <span class="pl-c1">%jl_value_t</span> <span class="pl-k">addrspace</span>(<span class="pl-c1">10</span>)** <span class="pl-c1">%20</span>
  <span class="pl-k">ret</span> <span class="pl-k">void</span>
}</pre></div>
<p dir="auto">Bisected to <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/JuliaLang/julia/commit/9277d3af2dcfc107021989473829a6c9454d83fb/hovercard" href="https://github.com/JuliaLang/julia/commit/9277d3af2dcfc107021989473829a6c9454d83fb"><tt>9277d3a</tt></a>.</p>
<p dir="auto">Somehow all atomics became really slow and allocating. Example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="julia&gt; using Base.Threads
julia&gt; using BenchmarkTools
julia&gt; a = Atomic{Int64}(0);

julia&gt; @btime atomic_add!($a,$1);
  9.177 ns (0 allocations: 0 bytes)
julia&gt; versioninfo()
Julia Version 0.6.3

julia&gt; @btime atomic_add!($a,$1);
  129.263 ns (1 allocation: 16 bytes)
julia&gt; versioninfo()
Julia Version 0.7.0-alpha.136"><pre class="notranslate"><code class="notranslate">julia&gt; using Base.Threads
julia&gt; using BenchmarkTools
julia&gt; a = Atomic{Int64}(0);

julia&gt; @btime atomic_add!($a,$1);
  9.177 ns (0 allocations: 0 bytes)
julia&gt; versioninfo()
Julia Version 0.6.3

julia&gt; @btime atomic_add!($a,$1);
  129.263 ns (1 allocation: 16 bytes)
julia&gt; versioninfo()
Julia Version 0.7.0-alpha.136
</code></pre></div>
<p dir="auto">This is very visible when inspecting <code class="notranslate">@code_llvm</code>: Instead of the hand-written llvmcall, we get some weird giant blob of compiler output.</p>