<div dir="ltr"><div>I'm trying to figure out exactly how the intrinsics/libc/libm work in llvm.</div><div><br></div><div>For example, this code return user defined function:</div><div><br></div><div><br></div><div>float acos(float x, float y)</div><div>{</div><div>    return x+y;</div><div>}</div><div><br></div><div>float a;<br>void foo(float b, float c)<br>{<br> a = acos(b, c);<br>}</div><div><br></div><div><br></div><div>But this code returns llvm.intrinsic:</div><div><br></div><div><br></div><div>float acos(float, float);</div><div><br></div><div>float a;<br>void foo(float b, float c)<br>{<br> a = acos(b, c);<br>}</div><div><br></div><div>float acos(float x, float y)<br>{<br> return x+y;<br>}</div><div><br></div><div>What is the expected behavior here? </div><div><br></div><div>Also, there are certain "standard C library functions" included in LLVM that I'd like to remove without modifying core code, is this possible? </div><div><br></div><div>I'm also curious how LLVM handles pure functions in regards to optimizations. For example, libm functions such as acos. It appears that X86 doesn't have acos as an intrinsic and instead just calls a function "tail call @acos...", is this still able to be optimized. I see the hardcoded 'name' lookup for 'acos' in ConstantFolding.cpp. It doesn't appear that if you slightly change the name from 'acos' to say 'XXX_acos' in your libm it'll still be optimized?</div><div><br></div><div>Thanks,</div><div><br></div><div>Ryan</div></div>