<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="use E::{A,B};

#[derive(Debug, Clone)]
enum E {
    A(i64),
    B(Box&lt;E&gt;),
}

fn f(a: &amp;mut E) {
    *a = match *a {
        B(ref b) =&gt; *b.clone(),
        _ =&gt; a.clone(),
    }
}

fn main() {
    let mut a = B(Box::new(A(1)));
    f(&amp;mut a);
}"><pre class="notranslate"><span class="pl-k">use</span> <span class="pl-v">E</span><span class="pl-kos">::</span><span class="pl-kos">{</span><span class="pl-v">A</span><span class="pl-kos">,</span><span class="pl-v">B</span><span class="pl-kos">}</span><span class="pl-kos">;</span>

<span class="pl-c1">#<span class="pl-kos">[</span>derive<span class="pl-kos">(</span><span class="pl-v">Debug</span><span class="pl-kos">,</span> <span class="pl-v">Clone</span><span class="pl-kos">)</span><span class="pl-kos">]</span></span>
<span class="pl-k">enum</span> <span class="pl-smi">E</span> <span class="pl-kos">{</span>
    <span class="pl-v">A</span><span class="pl-kos">(</span><span class="pl-smi">i64</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
    <span class="pl-v">B</span><span class="pl-kos">(</span><span class="pl-smi">Box</span><span class="pl-kos">&lt;</span><span class="pl-smi">E</span><span class="pl-kos">&gt;</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span>

<span class="pl-k">fn</span> <span class="pl-en">f</span><span class="pl-kos">(</span><span class="pl-s1">a</span><span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">E</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-c1">*</span>a = <span class="pl-k">match</span> <span class="pl-c1">*</span>a <span class="pl-kos">{</span>
        <span class="pl-v">B</span><span class="pl-kos">(</span><span class="pl-k">ref</span> b<span class="pl-kos">)</span> =&gt; <span class="pl-c1">*</span>b<span class="pl-kos">.</span><span class="pl-en">clone</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
        _ =&gt; a<span class="pl-kos">.</span><span class="pl-en">clone</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-k">fn</span> <span class="pl-en">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">let</span> <span class="pl-k">mut</span> a = <span class="pl-v">B</span><span class="pl-kos">(</span><span class="pl-smi">Box</span><span class="pl-kos">::</span><span class="pl-en">new</span><span class="pl-kos">(</span><span class="pl-v">A</span><span class="pl-kos">(</span><span class="pl-c1">1</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">f</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> a<span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">This code yields the following message during compilation:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Instruction does not dominate all uses!
  %9 = load %enum.E** %2, !nonnull !0
  %17 = bitcast %enum.E* %9 to i8*
Instruction does not dominate all uses!
  %9 = load %enum.E** %2, !nonnull !0
  %21 = bitcast %enum.E* %9 to i8*
LLVM ERROR: Broken function found, compilation aborted!"><pre class="notranslate"><code class="notranslate">Instruction does not dominate all uses!
  %9 = load %enum.E** %2, !nonnull !0
  %17 = bitcast %enum.E* %9 to i8*
Instruction does not dominate all uses!
  %9 = load %enum.E** %2, !nonnull !0
  %21 = bitcast %enum.E* %9 to i8*
LLVM ERROR: Broken function found, compilation aborted!
</code></pre></div>
<p dir="auto">The functions below are OK:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="fn foo1(x: Option&lt;Box&lt;int&gt;&gt;) -&gt; Option&lt;int&gt; {
    let res = match x {
        Some(ref v) =&gt; v.clone(),
        None =&gt; return None
    };
    Some(*res)
}
fn foo2(x: Option&lt;Box&lt;int&gt;&gt;) -&gt; Option&lt;int&gt; {
    let res = match x {
        Some(ref v) =&gt; Some(*v.clone()),
        None =&gt; return None
    };
    return res;
}"><pre class="notranslate"><span class="pl-k">fn</span> <span class="pl-en">foo1</span><span class="pl-kos">(</span><span class="pl-s1">x</span><span class="pl-kos">:</span> <span class="pl-smi">Option</span><span class="pl-kos">&lt;</span><span class="pl-smi">Box</span><span class="pl-kos">&lt;</span><span class="pl-smi">int</span><span class="pl-kos">&gt;</span><span class="pl-kos">&gt;</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">Option</span><span class="pl-kos">&lt;</span><span class="pl-smi">int</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">let</span> res = <span class="pl-k">match</span> x <span class="pl-kos">{</span>
        <span class="pl-v">Some</span><span class="pl-kos">(</span><span class="pl-k">ref</span> v<span class="pl-kos">)</span> =&gt; v<span class="pl-kos">.</span><span class="pl-en">clone</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
        <span class="pl-v">None</span> =&gt; <span class="pl-k">return</span> <span class="pl-v">None</span>
    <span class="pl-kos">}</span><span class="pl-kos">;</span>
    <span class="pl-v">Some</span><span class="pl-kos">(</span><span class="pl-c1">*</span>res<span class="pl-kos">)</span>
<span class="pl-kos">}</span>
<span class="pl-k">fn</span> <span class="pl-en">foo2</span><span class="pl-kos">(</span><span class="pl-s1">x</span><span class="pl-kos">:</span> <span class="pl-smi">Option</span><span class="pl-kos">&lt;</span><span class="pl-smi">Box</span><span class="pl-kos">&lt;</span><span class="pl-smi">int</span><span class="pl-kos">&gt;</span><span class="pl-kos">&gt;</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">Option</span><span class="pl-kos">&lt;</span><span class="pl-smi">int</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">let</span> res = <span class="pl-k">match</span> x <span class="pl-kos">{</span>
        <span class="pl-v">Some</span><span class="pl-kos">(</span><span class="pl-k">ref</span> v<span class="pl-kos">)</span> =&gt; <span class="pl-v">Some</span><span class="pl-kos">(</span><span class="pl-c1">*</span>v<span class="pl-kos">.</span><span class="pl-en">clone</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
        <span class="pl-v">None</span> =&gt; <span class="pl-k">return</span> <span class="pl-v">None</span>
    <span class="pl-kos">}</span><span class="pl-kos">;</span>
    <span class="pl-k">return</span> res<span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">but:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="fn foo3(x: Option&lt;Box&lt;int&gt;&gt;) -&gt; Option&lt;int&gt; {
    let res = match x {
        Some(ref v) =&gt; *v.clone(),
        None =&gt; return None
    };
    Some(res)
}"><pre class="notranslate"><span class="pl-k">fn</span> <span class="pl-en">foo3</span><span class="pl-kos">(</span><span class="pl-s1">x</span><span class="pl-kos">:</span> <span class="pl-smi">Option</span><span class="pl-kos">&lt;</span><span class="pl-smi">Box</span><span class="pl-kos">&lt;</span><span class="pl-smi">int</span><span class="pl-kos">&gt;</span><span class="pl-kos">&gt;</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">Option</span><span class="pl-kos">&lt;</span><span class="pl-smi">int</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">let</span> res = <span class="pl-k">match</span> x <span class="pl-kos">{</span>
        <span class="pl-v">Some</span><span class="pl-kos">(</span><span class="pl-k">ref</span> v<span class="pl-kos">)</span> =&gt; <span class="pl-c1">*</span>v<span class="pl-kos">.</span><span class="pl-en">clone</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
        <span class="pl-v">None</span> =&gt; <span class="pl-k">return</span> <span class="pl-v">None</span>
    <span class="pl-kos">}</span><span class="pl-kos">;</span>
    <span class="pl-v">Some</span><span class="pl-kos">(</span>res<span class="pl-kos">)</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">produces a LLVM ERROR. The message is:</p>
<blockquote>
<p dir="auto">Instruction does not dominate all uses!<br>
%8 = load i64** %2<br>
%12 = bitcast i64* %8 to i8*<br>
LLVM ERROR: Broken function found, compilation aborted!</p>
</blockquote>
<p dir="auto">I'm sorry if it isn't a minimum example of this issue.</p>