Hi,
My application generates some C code which I then compile using LLVM+Clang before running it. For the compilation side of things, I have a class which one of the methods (the CompilerEngine::compileCode() method in https://raw.github.com/opencor/opencor/llvm_3.3/src/plugins/misc/Compiler/src/compilerengine.cpp) is based on the code from the clang-interpreter example (http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/clang-interpreter/main.cpp?view=co). The idea is therefore to create an instance of the ‘compiler’ class and, among other things, use its compileCode() whenever needed.
All of this works perfectly fine using LLVM+Clang 3.2, but not with LLVM+Clang 3.3. At least, not out of the box. Basically, the first time I try to compile some C code, everything is fine. However, if I try to compile some other C code, then I will get the following error message:
clang: for the -vectorize-loops option: may only occur zero or one times!
FWIW, I use the -O3 option which I understand makes implicit use of the loop vectorizer, and that seems to be the problem. Indeed, if I disable the loop vectorizer (using the -fno-vectorize option), then everything is fine but I clearly don’t want to have to do that. So, right now, my solution consists of commenting out the test for the number of option occurrences in the Option::addOccurrence() method (http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?view=co), but it is clearly not satisfactory either (even though it’s good enough for my particular purpose).
So, would anyone have any idea about what I might be missing, if anything?..
Cheers, Alan.