[LLVMdev] speed and code size issues

Eli Friedman eli.friedman at gmail.com
Sat Jul 18 00:38:16 PDT 2009

On Fri, Jul 17, 2009 at 10:21 PM, John Regehr<regehr at cs.utah.edu> wrote:
> The global maximally embarrasing function is one where various versions of
> gcc (including llvm-gcc) emit code returning constant 0 and clang emits
> 762 bytes of x86.  The C code is this:
>   int ZZ_00005bbd(int x,int y){return m1s((x?0:x),a8s(y,y));}

The thing about testcases like that is that they heavily stress
instcombine; as far as I can tell, that testcase basically boils down
to instcombine interacting badly with clang's output for
"(short)(x?0:x)>0" (it ends up turning it into something roughly
equivalent to "(short)x>0 && x==0", which it doesn't know how to
fold).  And fixing weird instcombine cases like that tends to be
tedious and not very relevant to real-world code.

> The other embarrassing thing about these functions is that most compilers
> miscompile some of the 7 million functions.  llvm-gcc and clang are the
> only ones we tested that actually get them all right.

Well, that's good :)


More information about the llvm-dev mailing list