<div dir="ltr">Hi,<div class="gmail_extra"><br><div class="gmail_quote">2017-06-19 8:45 GMT-07:00 Andrew Kelley via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Greetings,</div><div><br></div><div>I have a Zig implementation of ceil which is emitted into LLVM IR like this:</div><div><br></div><div><div>; Function Attrs: nobuiltin nounwind</div><div>define internal fastcc float @ceil(float) unnamed_addr #3 !dbg !644 {</div><div>Entry:</div><div>  %x = alloca float, align 4</div><div>  store float %0, float* %x</div><div>  call void @llvm.dbg.declare(metadata float* %x, metadata !649, metadata !494), !dbg !651</div><div>  %1 = load float, float* %x, !dbg !652</div><div>  %2 = call fastcc float @ceil32(float %1) #8, !dbg !656</div><div>  ret float %2, !dbg !657</div><div>}</div></div><div><br></div><div>Test case:</div><div><br></div><div><div>test "math.ceil" {</div><div>    assert(ceil(f32(0.0)) == ceil32(0.0));</div><div>    assert(ceil(f64(0.0)) == ceil64(0.0));</div><div>}</div></div><div><br></div><div><br></div><div>When I compile with optimizations on, this test case fails. The optimized code for the test case ends up being a call to panic (assertion failure), which means that LLVM determined the test failed at compile-time.</div><div><br></div><div>What's strange about this is that if I change the function name from @ceil to @ceil_asdf (and change the callers) then the test passes.</div><div><br></div><div>So I think LLVM is doing some kind of string comparison on the symbol name and detecting that it is "ceil" and then having different, undesired behavior.</div><div><br></div><div>I tried putting `nobuiltin` in the function attributes and at the callsite, but that did not change anything.</div><div><br></div><div>Any ideas what's going on?</div></div></blockquote><div><br></div><div>I think it'd be a lot easier to figure if you provide a standalone repro.</div><div><br></div><div>-- </div><div>Mehdi</div><div><br></div></div></div></div>