[polly] r211612 - [Refactor] Create nicer test cases from C/C++
Johannes Doerfert
jdoerfert at codeaurora.org
Tue Jun 24 10:02:53 PDT 2014
Author: jdoerfert
Date: Tue Jun 24 12:02:53 2014
New Revision: 211612
URL: http://llvm.org/viewvc/llvm-project?rev=211612&view=rev
Log:
[Refactor] Create nicer test cases from C/C++
Insert a header into the new testcase containing a sample RUN line a FIXME and
an XFAIL. Then insert the formated C code and finally the LLVM-IR without
attributes, the module ID or the target triple.
Modified:
polly/trunk/test/create_ll.sh
Modified: polly/trunk/test/create_ll.sh
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/create_ll.sh?rev=211612&r1=211611&r2=211612&view=diff
==============================================================================
--- polly/trunk/test/create_ll.sh (original)
+++ polly/trunk/test/create_ll.sh Tue Jun 24 12:02:53 2014
@@ -1,8 +1,33 @@
#!/bin/sh
LLFILE=`echo $1 | sed -e 's/\.c/.ll/g'`
+LLFILE_TMP=${LLFILE}.tmp
+
+# The number of lines to cut of the LLVM-IR file clang produces.
+CUT_N_LINES=9
clang -c -S -emit-llvm -O0 $1 -o ${LLFILE}
opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars \
--instnamer ${LLFILE} -S -o ${LLFILE}
+-instnamer ${LLFILE} -S -o ${LLFILE_TMP}
+
+# Insert a header into the new testcase containing a sample RUN line a FIXME and
+# an XFAIL. Then insert the formated C code and finally the LLVM-IR without
+# attributes, the module ID or the target triple.
+echo '; RUN: opt %loadPolly -analyze < %s | FileCheck %s' > ${LLFILE}
+echo ';' >> ${LLFILE}
+echo '; FIXME: Edit the run line and add checks!' >> ${LLFILE}
+echo ';' >> ${LLFILE}
+echo '; XFAIL: *' >> ${LLFILE}
+echo ';' >> ${LLFILE}
+clang-format $1 | sed -e 's/^/; /' >> ${LLFILE}
+echo ';' >> ${LLFILE}
+
+cat ${LLFILE_TMP} | sed -e 's/ \#0//' >> ${LLFILE}
+sed -i".tmp" '/; Function Attrs:/d' ${LLFILE}
+sed -i".tmp" '/; ModuleID =/d' ${LLFILE}
+sed -i".tmp" '/target triple/d' ${LLFILE}
+
+head --lines=-${CUT_N_LINES} ${LLFILE} > ${LLFILE_TMP}
+
+mv ${LLFILE_TMP} ${LLFILE}
More information about the llvm-commits
mailing list