mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-07 16:42:34 +00:00
41f02a9960
- Instead of running with -O0, we enable the highest optimization level, but then disable optimizations. This ensures that possibly important metadata is still emitted. - Update the code for attribute removal to work with latest LLVM - Do not cut an arbitrary number of lines from the LL file. It is undocumented why this was needed at the first place, and such a feature is likely to break with trivial IR changes that may come in the future. llvm-svn: 307355
31 lines
1.0 KiB
Bash
Executable File
31 lines
1.0 KiB
Bash
Executable File
#!/bin/sh -e
|
|
|
|
LLFILE=`echo $1 | sed -e 's/\.c/.ll/g'`
|
|
LLFILE_TMP=${LLFILE}.tmp
|
|
|
|
clang -c -S -emit-llvm -O3 -mllvm -disable-llvm-optzns $1 -o ${LLFILE}
|
|
|
|
opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars \
|
|
-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/^[^$]/; &/' -e 's/^$/;/' >> ${LLFILE}
|
|
echo ';' >> ${LLFILE}
|
|
|
|
cat ${LLFILE_TMP} >> ${LLFILE}
|
|
sed -i".tmp" '/attributes .* =/d' ${LLFILE}
|
|
sed -i".tmp" -e 's/) \#[0-9]*/)/' ${LLFILE}
|
|
sed -i".tmp" '/; Function Attrs:/d' ${LLFILE}
|
|
sed -i".tmp" '/; ModuleID =/d' ${LLFILE}
|
|
sed -i".tmp" '/target triple/d' ${LLFILE}
|
|
|
|
mv ${LLFILE_TMP} ${LLFILE}
|