From 2fc36e19b19bb7836e9ccc67c80c7fe7aa4f4a03 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 15 Dec 2010 06:38:24 +0000 Subject: [PATCH] add a note about a SPEC hack that gcc mainline does. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121849 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/README.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/Target/README.txt b/lib/Target/README.txt index 836e74e6bc5..70dc136c5f0 100644 --- a/lib/Target/README.txt +++ b/lib/Target/README.txt @@ -1226,6 +1226,29 @@ loadpre14.c loadpre15.c actually a conditional increment: loadpre18.c loadpre19.c +//===---------------------------------------------------------------------===// + +[LOAD PRE / STORE SINKING / SPEC HACK] + +This is a chunk of code from 456.hmmer: + +int f(int M, int *mc, int *mpp, int *tpmm, int *ip, int *tpim, int *dpp, + int *tpdm, int xmb, int *bp, int *ms) { + int k, sc; + for (k = 1; k <= M; k++) { + mc[k] = mpp[k-1] + tpmm[k-1]; + if ((sc = ip[k-1] + tpim[k-1]) > mc[k]) mc[k] = sc; + if ((sc = dpp[k-1] + tpdm[k-1]) > mc[k]) mc[k] = sc; + if ((sc = xmb + bp[k]) > mc[k]) mc[k] = sc; + mc[k] += ms[k]; + } +} + +It is very profitable for this benchmark to turn the conditional stores to mc[k] +into a conditional move (select instr in IR) and allow the final store to do the +store. See GCC PR27313 for more details. Note that this is valid to xform even +with the new C++ memory model, since mc[k] is previously loaded and later +stored. //===---------------------------------------------------------------------===//