[PATCH] Add option to selectively disable the GVN pass.

Dimitry Andric dimitry at andric.com
Fri May 29 12:02:16 PDT 2015


I originally posted http://reviews.llvm.org/D5859 for this, and a little overview in http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141117/245549.html .

The test case (a preprocessed version of the second stage x86 bootloader for FreeBSD) is here: http://www.andric.com/freebsd/clang/boot2-minimal.c

We normally compile this with the following flags for clang versions earlier than 3.5.0:

  clang -cc1 -triple i386-unknown-freebsd11.0 -emit-obj -mrelocation-model static -mregparm 3 -mrtd -target-cpu i386 -Os -w -ffreestanding -mstack-alignment=8 -mllvm -inline-threshold=3 -mllvm -enable-load-pre=false -mllvm -simplifycfg-dup-ret boot2-minimal.c

and for 3.5.0 and later, we use the -enable-gvn flag instead:

  clang -cc1 -triple i386-unknown-freebsd11.0 -emit-obj -mrelocation-model static -mregparm 3 -mrtd -target-cpu i386 -Os -w -ffreestanding -mstack-alignment=8 -mllvm -inline-threshold=3 -mllvm -enable-load-pre=false -mllvm -enable-gvn=false boot2-minimal.c

Using clang 3.6.1, which is in FreeBSD 11-CURRENT at this time, I get the following results when I enable or disable the GVN pass:

  text    data     bss     dec     hex filename
  5466      12    4936   10414    28ae test-361-gvn-enabled.o
  5447      12    4936   10395    289b test-361-gvn-disabled.o

E.g. it saves 19 bytes.  I tried this again with clang trunk r238353, but there the results are the other way around:

  text    data     bss     dec     hex filename
  5359      12    4932   10303    283f test-trunk-gvn-enabled.o
  5392      12    4932   10336    2860 test-trunk-gvn-disabled.o

So apparently the size optimizations work better now...  I should probably put this review on hold, until I can test building the complete bootloader suite with a recent clang trunk snapshot.


http://reviews.llvm.org/D10069

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list