<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 18, 2020, 18:51 Juneyoung Lee via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>I guess in many cases Rust/Swift functions can be lowered into IR functions with not_poison flags attached (though I'm not an Rust/Swift expert, so just a guess)</div><div>For C, people may want to allow idioms like below, so further investigation is needed:</div><div><br></div><div>int x, y;</div><div>if (cond) x = 1; else y = 1;</div><div>f(cond, x, y);</div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">The same thing can be done in Rust, though I expect it to be less common:</div><div dir="auto"><br></div><div dir="auto"><div dir="auto">let mut x = MaybeUninit::<i32>::uninit();</div><div dir="auto"><div dir="auto">let mut y = MaybeUninit::<i32>::uninit();</div><div dir="auto">unsafe {</div><div dir="auto"> if cond {</div><div dir="auto"> x.as_mut_ptr().write(1);</div><div dir="auto"> } else {</div><div dir="auto"> y.as_mut_ptr().write(1);</div><div dir="auto"> }</div><div dir="auto">}</div><div dir="auto">f(cond, x, y);</div><div dir="auto"><br></div><div dir="auto">Jacob Lifshay</div><div dir="auto"><br style="font-family:sans-serif"></div></div></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>