3 LLFILE
=`echo $1 | sed -e 's/\.c/.ll/g'`
4 LLFILE_TMP
=${LLFILE}.tmp
6 # The number of lines to cut of the LLVM-IR file clang produces.
9 clang
-c -S -emit-llvm -O0 $1 -o ${LLFILE}
11 opt
-correlated-propagation -mem2reg -instcombine -loop-simplify -indvars \
12 -instnamer ${LLFILE} -S -o ${LLFILE_TMP}
14 # Insert a header into the new testcase containing a sample RUN line a FIXME and
15 # an XFAIL. Then insert the formated C code and finally the LLVM-IR without
16 # attributes, the module ID or the target triple.
17 echo '; RUN: opt %loadPolly -analyze < %s | FileCheck %s' > ${LLFILE}
19 echo '; FIXME: Edit the run line and add checks!' >> ${LLFILE}
21 echo '; XFAIL: *' >> ${LLFILE}
23 clang-format
$1 |
sed -e 's/^[^$]/; &/' -e 's/^$/;/' >> ${LLFILE}
26 cat ${LLFILE_TMP} |
sed -e 's/ \#0//' >> ${LLFILE}
27 sed -i".tmp" '/; Function Attrs:/d' ${LLFILE}
28 sed -i".tmp" '/; ModuleID =/d' ${LLFILE}
29 sed -i".tmp" '/target triple/d' ${LLFILE}
31 head --lines=-${CUT_N_LINES} ${LLFILE} > ${LLFILE_TMP}
33 mv ${LLFILE_TMP} ${LLFILE}