[PATCH] D40594: [InstCombine] miscompile of __builtin_fmod

Sanjay Patel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 29 06:20:46 PST 2017


spatel added reviewers: efriedma, hfinkel.
spatel added a comment.

I don't know the history of the frem instruction in IR, and the description in http://llvm.org/docs/LangRef.html#frem-instruction is vague.

But based on the existing code, I think this is working as intended. If the instruction has the same semantics as the math library function 'fmod', then we do want to convert this to an IR instruction in clang.

Note that when I filed PR34870, I assumed the bug was in the IR optimizer in the instcombine pass, but if the IR instruction does not match the semantics of the math library function, then I'd be wrong. :)


https://reviews.llvm.org/D40594





More information about the cfe-commits mailing list